[Vienna-pm] regex beim scriptaufruf als argument uebergeben

Thomas Klausner domm at zsi.at
Mon Feb 28 11:21:06 PST 2005


Hi!

On Mon, Feb 28, 2005 at 07:03:58PM +0100, Baier Oliver wrote:

> 	$ ./replace.pl '! eine' '!\n eine'
> .. 
> 	my ($old,$new) = @ARGV;

nicht gerade elegant, und vielleicht gibts eine bessere Loesung, aber so
scheints zu gehen:

  $new=eval '"'.$new.'"';


Andererseits gehts so auch:

~$ perl foo.pl '! eine' '!     
> eine'

(also wenn der \n nicht als Escape sondern tatsaechlich eingegeben wird.

Anscheinend werden die $ARGV als single quoted strings interpretiert...


-- 
#!/usr/bin/perl                               http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}


More information about the Vienna-pm mailing list