dynamically substituting variable name

Discussion in 'Perl Misc' started by mostart, Jul 17, 2003.

  1. mostart

    mostart Guest

    hi,

    I want to dynamically substitute a variables name.
    I know this from PHP where you can have somthing like
    ${$foo}

    how can I do this in perl ??

    thanks
    mostart
    mostart, Jul 17, 2003
    #1
    1. Advertising

  2. mostart wrote:
    > I want to dynamically substitute a variables name.
    > I know this from PHP where you can have somthing like
    > ${$foo}
    >
    > how can I do this in perl ??


    You may want to check The Fine Manual about why it's a bad idea to use
    symbolic references and what better options are available: perldoc -q
    'variable name'

    How can I use a variable as a variable name?
    Beginners often think they want to have a variable contain the
    name of a variable.
    [...]
    This works *sometimes*, but it is a very bad idea for two
    reasons. [...]

    jue
    Jürgen Exner, Jul 17, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Fish
    Replies:
    2
    Views:
    392
    Young Seeker
    Dec 29, 2003
  2. Christian Schlichtherle
    Replies:
    8
    Views:
    467
    John Currier
    Jul 5, 2005
  3. lugal
    Replies:
    2
    Views:
    303
    Peter Otten
    Mar 23, 2005
  4. Bobby Chamness
    Replies:
    2
    Views:
    2,378
    Joe Smith
    Apr 22, 2007
  5. brahatha
    Replies:
    0
    Views:
    277
    brahatha
    Jun 6, 2007
Loading...

Share This Page