Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^2: list separation

by robertw (Sexton)
on Aug 26, 2012 at 04:28 UTC ( #989784=note: print w/replies, xml ) Need Help??

in reply to Re: list separation
in thread list separation

Thank you for your help:), Is it however also possible to create a variable, its name consisting of another variable's value?

$ast = "best"; $fred = "date"; $"$ast" = 1; print "$best";

the variable $best should have been created by using the value of $ast as it's name

Replies are listed 'Best First'.
Re^3: list separation
by GrandFather (Sage) on Aug 26, 2012 at 05:21 UTC

    There are ways of doing that in Perl, but it's worse than picking your nose in public - don't do it.

    If there is some aspect of the code I presented that you don't understand ask about it instead of thinking up ways to avoid it. I suspect you are having trouble with Perl's hashes. If you expect to spend any significant time writing Perl understanding Perl's hash (associative array) data type is critical to using the language well. See perldata for information about Perl's data types. There is a lot to take in there. Take it a little at a time. Back up to the start of a section when you hit a bit you don't understand right off. If something really doesn't make sense come back here and ask.

    True laziness is hard work

      Thank you and you are absolutely right, I know what you wrote is right only I don't understand why yet and how.Thank you as well for shaping me to be a decent perl programmer who does not do the equivalent of picking his nose in public in perl:) I appreciate your help, I am going to study hashes now:P

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989784]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2018-05-20 10:34 GMT
Find Nodes?
    Voting Booth?