in reply to Passing or reference to a subroutine

You can do it like this:

mysub( [ 'item1', 'item2' ], { key1 => 1, key2 => 2 } );

The [] brackets create a reference to an anonymous literal array. And {} brackets create a reference to an anonymous literal hash.

The way you were trying to do it doesn't work because \(item1, item2) is the same as ( \item1, \item2 )


Dave

Replies are listed 'Best First'.
Re^2: Passing or reference to a subroutine
by cosmicperl (Chaplain) on Dec 06, 2005 at 06:31 UTC
    For some reason I was putting a \ in front. God knows why. Thanks for the help.