in reply to Split ( ) is Giving Me a Splitting Headache
In your case, you're only passing in a single argument to split. Perl interprets this as /PATTERN/ and implicitly uses $_ as the EXPR. Since $_ hasn't been initialzed yet (hence the warning) nothing really happens (it's trying to split an undefined value on occurences of "Hello World").perldoc -f split split /PATTERN/,EXPR,LIMIT split /PATTERN/,EXPR split /PATTERN/
my $Phrase = "Hello World"; my @Parts = split(/ /, $Phrase); # split $Phrase on spaces
|
|---|