using 'negative look-ahead' assertions

2006-07-21 Thread Jhst463
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 tha

passing an array to subroutines

2006-07-21 Thread Jhst463
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 subrout

Resolved: passing by value ...

2006-07-04 Thread Jhst463
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 demonstrates

passing by value vs. passing by reference

2006-07-04 Thread Jhst463
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