Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: declaring same variable

by aging acolyte (Pilgrim)
on Jan 20, 2004 at 17:22 UTC ( [id://322641] : note . print w/replies, xml ) Need Help??


in reply to declaring same variable

Just declare my @xxx once.

my $op = "numbers"; # for example my @xxx = qw(one two three) if ( $op eq "numbers" ); @xxx = qw(four five) if ( $op eq "alpha" ); @xxx = qw(six ten) if ( $op eq "alp" ); print "@xxx\n";
results in: one two three

A.A.