A
Alex Johnson
hi, i'm trying to call a variable where the variables name is
constructed using text and the value of another variable, the kind of
code that i'm trying to write would be something like this:
#!/usr/bin/perl -w
my $var1 = "three";
my $total = 1;
$var2 = '$var' . $total;
print "$var2";
but rather than printing literally '$var1' i want it to print the
contents of the variable $var1, so it should print 'three', i couldn't
find the answer in the perl books, probably because don't know the
keyword to look for, or else just one of those things that's so simple
it's assumed you know already, so any advice would be gratefully
received.
thanks in advance,
Alex.
constructed using text and the value of another variable, the kind of
code that i'm trying to write would be something like this:
#!/usr/bin/perl -w
my $var1 = "three";
my $total = 1;
$var2 = '$var' . $total;
print "$var2";
but rather than printing literally '$var1' i want it to print the
contents of the variable $var1, so it should print 'three', i couldn't
find the answer in the perl books, probably because don't know the
keyword to look for, or else just one of those things that's so simple
it's assumed you know already, so any advice would be gratefully
received.
thanks in advance,
Alex.