Hey all,

I've come across a bizarre problem working with a Perl from my OS X box 
(Perl 5.6.1) where trying to do a substitution from a one-liner causes 
some seriously weird errors. Here's the problem boiled down:

If I try to execute

% perl -e 's/foo/bar/' test.txt

from the command-line no problem... works as expected. However, if I try 
to do a substitution with an exclamation mark in it, such as

% perl -e 's/foo!/bar/' test.txt

I get a "/bar/: Event not found." error. More to the point, when you hit 
the "up" arrow to access the last command (I'm using the default tcsh 
shell) the command that comes up is:

% perl -e 's/foo' test.txt

which is really bizarre. If you escape the ! mark

% perl -e 's/\!/bar/' test.txt

no problem, but if you use two ! and you only escape one, like

% perl -e 's/\!/bar!/' test.txt

you get

"perl -e 's/!/bar/Users/gary/recur/recur.pl' test.txt
Bareword found where operator expected at -e line 1, near "s/!/bar/Users"
syntax error at -e line 1, near "s/!/bar/Users"
Execution of -e aborted due to compilation errors."

where /Users/gary/recur/recur.pl happens to be the path to a program 
that's triggered through crontab.

Anyone have any idea what's going on? The "!" isn't one of the 
metcharacters, and all this code works exactly as expected whenever you 
run it within an actual Perl file (i.e., not from a one-liner.) I tried 
this code on Linux and ActiveState Perl and everything works fine, which 
makes me think it's an OS X/Darwin thing. Thoughts? Thanks!

---
Gary Blackburn
[EMAIL PROTECTED]

Reply via email to