What you are telling Perl is this:

@data = "test1,test2,test3,test4";
#Store this string in $data[0]

@data = split(/,/);
#replace the contents of @data with the result
#of splitting $_ by /,/
#($_ is not defined at this point)

print $data[1];
#print the second element of $data
#(which does not exist)


-----Original Message-----
From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 6:54 PM
To: [EMAIL PROTECTED]
Subject: Perl simple array



Hey All,

Just wondering why the following code won't print anything at all.

@data = "test1,test2,test3,test4";

@data = split(/,/);

print $data[1];

Will not print anything...

Any ideas?

Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to