Results 1 to 3 of 3
Related
-
Split categories in half. Forum: CGI Perl Forum
Replies: 4 -
[split] PHP upload script. Forum: PHP Forum
Replies: 3
-
08-27-2007, 03:07 AM #1
How to split a pipe separated string in CGI/Perl.
Hi all,
I am hitting some URL from my perl page, and getting some Values as response which are pipe separated.
Here I have two queries,
1) how to read that response into a local variable.
2) How to split that local variable.
-
10-14-2007, 11:20 PM #2
Re: How to split a pipe separated string in CGI/Perl.
Hello, not totally sure what you mean... But if you have a string like this...
my $string = "One|Two|Three|Four|Five";
Each element is devided using | character...
We can split the string like this...
my @string_split = split(/\|/, $string);
now you can either use a foreach loop to do something to each element of the array or if you know which one you want...
i.e.
my $one_i_want = @string[2]
### $one_i_want would then have the value Three stored to it.
About reading the response, not totally sure what you mean. Reading from a file? Or sending the data to the script directly?
Chris
-
10-14-2007, 11:21 PM #3
Re: How to split a pipe separated string in CGI/Perl.
I made a mistake...
my $one_i_want = @string[2]
should have been...
my $one_i_want = @string_split[2]
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum