http://qs321.pair.com?node_id=11106579


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

You could make this explicit by using:

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

Replies are listed 'Best First'.
Re^4: Duplicate variable returned from sub
by Zenzizenzizenzic (Pilgrim) on Sep 23, 2019 at 17:17 UTC
    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:  <%-{-{-{-<