on a side note
This
$line =~ s/^[^=]*\=//;
is IMHO better written as
my ($var,$list) = split /=/, $line, 2; °
It's not only much easier to read and self-documenting, you'll also have a chance to check if $var eq "Teams"
And if $var is of no interest you can also write
my ( undef, $list ) = split /=/, $line;
debugger demo
DB<211> $line = "Teams=PATRIOTS,BILLS,DOLPHINS,JETS,COWBOYS,GIANTS,E +AGLES,REDSKINS,BENGALS,OILERS,STEELERS,BROWNS,SEAHAWKS,RAMS,49ERS,RAI +DERS" DB<212> x ($var,$list) = split /=/, $line 0 'Teams' 1 'PATRIOTS,BILLS,DOLPHINS,JETS,COWBOYS,GIANTS,EAGLES,REDSKINS,BENGAL +S,OILERS,STEELERS,BROWNS,SEAHAWKS,RAMS,49ERS,RAIDERS'
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) the 2 in case you are worried that the character "=" appears in your list elements
In reply to Re^3: How to Split on specific occurrence of a comma
by LanX
in thread How to Split on specific occurrence of a comma
by dirtdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |