Throw a "my" declaration in the loop statement:
for (my $i=0; $i<5; $i++) { print "$i : first_string ref[$i] second_string parent_ref.ref[$i] th +ird_string\n"; }
Update:
Forgot the $ref2 bit. So:
my $ref2 = 'parent_ref'; for (my $i=0; $i<5; $i++) { print "$i : first_string ref[$i] second_string $ref2.ref[$i] third_s +tring\n"; }
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
In reply to Re: Evaluating variables within a string
by nysus
in thread Evaluating variables within a string
by smknjoe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |