[Kc] perl -e syntax Win32

djgoku djgoku at gmail.com
Fri May 25 11:08:39 PDT 2007


So I was trying to create my first one liner today on a Windows Box:

Code:

C:\>perl -wT -e 'print "hello world";'
Can't find string terminator "'" anywhere before EOF at -e line 1.

I at first thought it was due to " or ' around "hello world" so I try
both ways still same error. Secondly, I thought if I change the outer
single quotes to double that might work? Well it did work.

So I started to write the one-liner!

C:\> program_output | perl -wT -e "$_ = /\"(\w+)\"/; print $1;"

program_output outputs a string like test: "blah1232" and all I want
is blah1232.

After figuring out the single/double quote problem I found this:

http://tinyurl.com/25gpxz


More information about the kc mailing list