Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

(tye)Re: creating dynamically named 'my' variables

by tye (Sage)
on Mar 01, 2002 at 06:52 UTC ( [id://148501]=note: print w/replies, xml ) Need Help??


in reply to creating dynamically named 'my' variables

I've wanted to do this before. That is just one reason why I want to be able to write:     eval "my \$$bar;" if $workAround BEGIN; where the statement-modifier BEGIN prevents the introduction of a new scope and stringy eval is changed to (be able to) avoid introducing a new level of scope.

But I'd probably do what you want with something like:

my $code= <FILE>; eval "my \$$bar;\n#line 1 "file"\n$code"; die $@ if $@;
I think.

        - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-24 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found