I keep all my import variables in a hash for safe keeping. I let these dynamic variables as listed above exist in the main root hash environment (if you could call it that).

so there's %ENV, %GET, %POST, %IP, %DEFAULTS, and %DATABASE. This is safer anyway. measure twice, declare once. I'm still not saying i'm right, but anti-soft reference arguments don't float.
Maybe it's the hash.

I wonder if a reminder of the beauty of 'local' would also help the case here.

After reading dominus's arguments against soft references i still remain. One could spend hours telling you how dangerous using perl is when you use the shebang line.

Then, i thought of 'local' and did a test...
Error 500 in the face.

This doesn't work.

#!/usr/bin/perl &tryLocal("name=james&color=red&age=12"); exit; #################### sub tryLocal{ local $in = $_[0]; @in = split(/\&/,$in); foreach $li(@in){ ($lname,$lvalue)=split(/\=/,$li); local $$lname = $lvalue; } }################# end tryLocal

This works.

#!/usr/bin/perl &tryLocal("name=james&color=red&age=12"); exit; #################### sub tryLocal{ local $in = $_[0]; @in = split(/\&/,$in); foreach $li(@in){ ($lname,$lvalue)=split(/\=/,$li); $$lname = $lvalue; } }################# end tryLocal

Which leads me to say. I was wrong.
As you fall in love with local
(which i have been doing all summer),
you must abandon my old ways.
Create your hash and check $TEMP{$passcode}
instead of $passcode.

In reply to Re: Re: Re: Many strings make one variable? by true
in thread Many strings make one variable? by heezy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.