2009/1/6 bc.other <[email protected]>: > OK, I will explain > > I got 2 variables: $var1 = 100 and $var2 = 200 > And I got another variable $digit = 1 > > I need a way to print $var1 using $digit and string "var" > I tried ${"var" . $digit} but it didn't work for me, > I tried $var{$digit} - but it will try look for hash value - nnoooo > I tried $var${digit} - but it's an error mistake....:-( > > The reason I need it, because I need to loop on different variables (same > name, different digits) > and check their value against something....and I wanted to do that using a > for/while loop...
I believe that it's possible to do it with references, but i don't have Perl on this machine to test it. But seriously, do yourself a favor and simply use an array or a hash instead. -- Amir Elisha Aharoni heb: http://haharoni.wordpress.com | eng: http://aharoni.wordpress.com cat: http://aprenent.wordpress.com | rus: http://amire80.livejournal.com "We're living in pieces, I want to live in peace." - T. Moore _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl
