What's in an Array, Index Numbers
@ft=("London", "Paris", "Tokyo");
print "$ft[0]";
Which prints:
London
-The array we named @ft has three cities stored in it.
-The INDEX NUMBERS start with zero, so $ft[0] equals London, $ft[1] equals Paris and so on.
NOTE: We didn't need to SPLIT the array, because it was already in pieces. Had the array looked like this: "London,Paris,Tokyo" with quotes around the whole thing, we would have needed to
split like this:
@ft=split(/,/, "London,Paris,Tokyo");
Copy and Paste Perl Code:
#!/usr/bin/perl
print "Content-type:text.html\n\n";
@ft=("London", "Paris", "Tokyo");
print "$ft[0] ";
@ft=split(/,/, "London,Paris,Tokyo");
print "$ft[2]";
exit;
Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
| | | |
HTML Gary B. Shelly, Th... | | |
| | | CSS David McFarland |