How do I pass an array to a subroutine in a manner that the array is entirely
contained in one element of @_, instead of having each element mapped to
elements of @_.
for example, inside of the subroutine, I'd like to say
@z = @_[0];
and have @z refer to the entire array I passed to the
I'm trying to get all files of a directory whose name does not end with a
particular string.
I'm tried using:
@files = readdir DIR;
@otherfiles = grep /(?!java)/, @files;
but files with java in them are returned along with the other files.
I'd like to know, in general, how to get everything
I have a subroutine that, amongst other things, chops a scalar variable,
$dir, passed to it as an argument. The problem is that I need $dir intact (ie
unchopped) after calling said subroutine, but it has been altered by the chop.
I
can't figure out how to pass the value (or more precisely, a
Thanks everyone for your help, I found the problem was with (1) my
understanding of how Perl functions act on variables in general and (2) with
how chop in
particular behaved.
My subroutine originally contained this:
sub xyz {
$x = chop $_[0];
... do stuff with $x
}
which