Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: pushing a $variable into an array with varible name

by Ido (Hermit)
on Jun 18, 2004 at 00:15 UTC ( [id://367809]=note: print w/replies, xml ) Need Help??


in reply to pushing a $variable into an array with varible name

You are trying to use symbolic refs. This is usually a bad idea (and you should always use strict to avoid it...), but in case you know what you're doing and insist:
the expression:
test-$number-$string Is like  'test' - $string - $number
So, in all of the three push statements, you're pushing to the array @{-9} (strings are like 0 in numeral context, both 'vol1' and 'vol2', and the - operator implies numberal context).
What you'd probably want to do is use them as strings, such as:
@{"test-$contextID-$vol[0]"}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://367809]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-25 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found