[sf-perl] Anyone know why won't this work?

Richard Reina gatorreina at gmail.com
Wed Jul 24 09:42:40 PDT 2013


Can anyone tell me what I'm doing wrong?

#!/usr/bin/perl -w

my $string = 'The good\n\nThe bad\n\nThe Ugly';

my @str = split /\n\n/, $string;

print "Second thru last element: " . $str[1..$#str] . "\n";


GIVES ME:

Use of uninitialized value within @str in range (or flip) at
test_split.pl line 7.
Argument "" isn't numeric in array element at test_split.pl line 7.
Second thru last element: The good\n\nThe bad\n\nThe Ugly


More information about the SanFrancisco-pm mailing list