in reply to Conditional split?
( Please put code in <c>...</c> tags. )
( Please don't lie by saying your code outputs one thing when it doesn't even compile. Post the code you actually ran. )
The splitting occurs because "=====" is indeed not equal to "==.*". It's one character longer, for starters. Fix:
while (<>) { chomp; my @a; @a = split if !/^==/; print "@a\n"; }
But it makes no sense to process @a if you didn't put anything in it. Maybe you want
while (<>) { chomp; next if /^==/; my @a = split; print "@a\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Conditional split?
by chiragmp (Initiate) on Apr 07, 2009 at 23:10 UTC | |
by Anonymous Monk on Apr 08, 2009 at 06:09 UTC | |
|
Re^2: Conditional split?
by chiragmp (Initiate) on Apr 07, 2009 at 22:51 UTC |