----- Original Message ----- 
From: "Chris Charley" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: <[EMAIL PROTECTED]>
Sent: Monday, June 07, 2004 2:07 PM
Subject: Re: reading commandline parameters and <>


> > I am sorry I did not give the real situation before, I want to execute
> > this on command line like
> > 
> > perl -pe 's/$ARGV[1]/$ARGV[2]/' filename OLDSTR NEWSTR
> > 
> > Is this possible ? 
> > 
> > Thanks
> > Ram
> 
> 
> Why not
> 
> perl -pe 's/OLDSTR/NEWSTR/' filename

Sorry, To do it your way:

perl -pe 'BEGIN{$y=pop;$x=pop} s/$x/$y/' filename OLDSTR NEWSTR



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to