Write a FOREACH LOOP in Perl
Your variable $huhu has three cities
$huhu="London-Paris-Tokyo-";
You store the split pieces into your new array @gy
@gy=split(/-/, $huhu);
You get those pieces by using FOREACH to loop over your array @gy
foreach $gy(@gy) {
print "$gy<br>";
}
Which prints:
London
Paris
France
Start Copy and Paste Perl Code:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
$huhu="London-Paris-Tokyo-";
@gy=split(/-/, $huhu);
foreach $gy(@gy) {
print "$gy<br>";
}
exit;
Foreach Loop Perl CGI - See in Action (new window)
Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
| | CSS David McFarland | |
| | | |
| | | |