Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: Removing whitespace

by particle (Vicar)
on May 07, 2002 at 14:00 UTC ( #164641=note: print w/ replies, xml ) Need Help??


in reply to Re: Removing whitespace
in thread Removing whitespace

actually, the poster specified (my code tags for clarity) $user = $ENV {'Mike', 'Wallace'};, which is not a valid way to recover a single key from %ENV.

either he's looking for an array of environment vars (not likely), in which case he'd specify @ENV, or he's looking for a key named Mike', 'Wallace (which is valid on Win32,) which is referenced by $ENV{'Mike\', \'Wallace'}. NOTE: this is platform specific--i can't find a way to set an environment variable with quotes on solaris or cygwin.

either way, Anonymous Monk probably meant what you said.

~Particle *accelerates*


Comment on Re: Re: Removing whitespace
Select or Download Code
Re: Re: Re: Removing whitespace
by Molt (Chaplain) on May 07, 2002 at 14:10 UTC

    It is a valid way, and is Perl's way of doing 'Multidimensional hashes' without hitting hashes of hashes. Admittedly $; isn't normally space, but such is.

    In Programming Perl 2nd Ed this is all on Page 133, my 3rd Ed. is at home at the moment I'm afraid so I can't give page reference in that.

    The following code actually works.. which is somewhat scary when it's simply not What You Mean, as I don't think it is in this case.

    #!/usr/bin/perl -w use strict; $ENV{'Paul', 'Golds'} = 'Molt'; print $ENV{'Paul', 'Golds'};

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2014-08-01 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (0 votes), past polls