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

Re: Pitfalls met while opening multiple files

by moritz (Cardinal)
on Jul 24, 2011 at 16:45 UTC ( #916424=note: print w/replies, xml ) Need Help??

in reply to Pitfalls met while opening multiple files

The problem here is that open has a prototype, so it puts the @$_ in scalar context instead of interpolating it into the argument list.

For normal routines that can be circumvented by calling it with an ampersand, &yourroutine(@$_). Unfortunately I don't know how that works with open, neither &CORE::open(@$_) nor &open(@$_) work.

Perl 6 solves this problem by introducing a new syntax for explicitly interpolating arrays and hashes into argument lists, there it would be spelled open |@argumentlist.

Replies are listed 'Best First'.
Re^2: Pitfalls met while opening multiple files
by armstd (Friar) on Jul 24, 2011 at 23:24 UTC

    Ah yes, that makes perfect sense.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://916424]
[holli]: what? the pm code you swindled your way into?
[LanX]: no already the pm code I'm allowed to see ... http://www. 1203338;style=css
[LanX]: understanding this code is like relearning space invaders and donkey Kong at the same time

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2017-11-20 21:34 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (294 votes). Check out past polls.