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

Re^2: Duplicate variable returned from sub

by Zenzizenzizenzic (Scribe)
on Sep 23, 2019 at 17:05 UTC ( #11106578=note: print w/replies, xml ) Need Help??


in reply to Re: Duplicate variable returned from sub
in thread Duplicate variable returned from sub

I am addressing the code issue, yes. Since we're running this on Linux and Solaris, I really don't want to rely on a "quirk" that the code run the same. Thank you!
  • Comment on Re^2: Duplicate variable returned from sub

Replies are listed 'Best First'.
Re^3: Duplicate variable returned from sub
by Perlbotics (Bishop) on Sep 23, 2019 at 17:12 UTC

    You could make this explicit by using:

    my (undef, $var2, $var3, $var1) = someFunction($var4);
    or refactoring someFunction() if that makes sense.

      I'm refactoring the function call. But was curious where the undef would need to be if I needed a "fast fix".
        ... where the undef would need to be ...

        What do you need to do? Assignment to undef in this way will "swallow" an item from the list returned by the function call; you will see it no more. Which item do you need to get rid of?

        But Your Mother is right: Fix this code, don't patch it; it's an accident waiting to happen.


        Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2020-10-23 02:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (234 votes). Check out past polls.

    Notices?