Richard Gordon wrote: > > When I attempt to run a script in bash under mkLinux that works fine under > MacPerl, I get a weird error on the command line that is something like: > > Sequence[?(root@localhost/cgi-bin)]# I have never seen that error before. Are you sure it's an error message from Perl? > I could have some of that wrong, but the point is that the prompt begins > with Sequence followed by ? and the script won't run. After monkeying around > with it for a file, I found that the offending portion is the grep line of > the following: > > opendir(DIR, $directory) or > die 'cannot open Commentary directory'; > @files = grep { /^(?:(?!_).)*$/ } readdir(DIR); > closedir(DIR); > > I'm just trying to create a list of files in a directory and am filtering > out some that have a _ in their names. If I change the line to > > @files = readdir(DIR); > > it works fine in mkLinux, but I lose filtering. So, is this a Mac thing, a > Linux thing, or what? Thanks. That's a very very ugly regex to filter out strings with '_' in them. (?:(?!_).) That matches any character that is not an underscore, correct? A much nicer way to say that is: [^_] [ Or, if you want to be pedantic: [^_\n] because (?:(?!_).) won't match newlines. ] So your grep command could be written as: grep { /^[^_]*$/ } readdir(DIR); But another way to say 'contains all non-underscores' is 'does not contain an underscore': grep { !/_/ } readdir(DIR); which, I think, is even simpler. I don't know why you were getting the 'error message' you mentioned above, so I don't know if this will fix your problem. It certainly can't hurt, though. Ronald ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch