On Jun 28, 2004, at 10:19 AM, Naser Ali wrote:
Hello all,
I have a line of text and numbers each seperated by multiple or single
spaces looks like this
abc 123 33545 789
I wanted to split the above line and store each column value in a
specific
variable and later print,
Below is the code I am using but it's not working as I desire,
$Avg=$first[$i];
chomp($Avg);
($label,$TD,$YT,$M,$L,$Y,$W)= split (/i\s*/,$Avg);
print "$label,$TD,$YT,$M,$L,$Y,$W\n";
I used "\s*" in split, so I do not have worry about counting the
spaces or
tabs between each field
Any suggestions on what am I doing wrong..?
There is an extra character at the front of that regex, an i character.
James
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>