Home > Archive > PERL Miscellaneous > April 2005 > Command Line single execution of a line(s) of code
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Command Line single execution of a line(s) of code
|
|
| Michael De Tomaso 2005-04-15, 3:58 am |
| I installed perl for WIN from ActiveState
D:\study\perl>perl -v
This is perl, v5.8.6 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)
Copyright 1987-2004, Larry Wall
....
And I was going to try to test some code from:
http://www.perldoc.com/perl5.8.4/pod/func/split.html
Q: let's say I wanted to run a single line of code such as:
print join(':', split(/ */, 'hi there'));
.... should I be able to run if from the command line like:
>perl -e print join(':', split(/ */, 'hi there'));
Q: should produce the line: " produces the output 'h:i:t:h:e:r:e'. " right
after the command right ???
- thanks & take care M.D.
<aka>
_ _
| |_ ___ _ __ ___ __ _ | |_ ___ ___
| __| / _ \ | '_ ` _ \ / _` | | __| / _ \ / _ \
| |_ | (_) | | | | | | | | (_| | | |_ | (_) | | __/
\__| \___/ |_| |_| |_| \__,_| \__| \___/ \___|
| |
| Gunnar Hjalmarsson 2005-04-15, 3:58 am |
| Michael De Tomaso wrote:
> I installed perl for WIN from ActiveState
<snip>
[color=darkred]
> Q: let's say I wanted to run a single line of code such as:
>
> print join(':', split(/ */, 'hi there'));
>
> ... should I be able to run if from the command line like:
>
Yes, but you are supposed to surround the statement with quotes; in the
case of Windows it must be double-quotes:
perl -e "print join(':', split(/ */, 'hi there'))"
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
| |
| Michael De Tomaso 2005-04-25, 8:56 pm |
| Try putting " quotes " around your statement:
perl -e "print join(':', split(/ */, 'hi there'))";
h:i:t:h:e:r:e
- take care M.D.
http://www.livejournal.com/users/datamd/1860.html
---
EOL - tron
"Michael De Tomaso" <mdetomaso@bak.rr.com> wrote in message
news:VxG7e.56$K25.34@news-wrt-01.socal.rr.com...[color=darkred]
>I installed perl for WIN from ActiveState
>
> D:\study\perl>perl -v
>
> This is perl, v5.8.6 built for MSWin32-x86-multi-thread
> (with 3 registered patches, see perl -V for more detail)
>
> Copyright 1987-2004, Larry Wall
>
> ...
>
> And I was going to try to test some code from:
>
> http://www.perldoc.com/perl5.8.4/pod/func/split.html
>
>
>
> Q: let's say I wanted to run a single line of code such as:
>
> print join(':', split(/ */, 'hi there'));
>
> ... should I be able to run if from the command line like:
>
>
>
> Q: should produce the line: " produces the output 'h:i:t:h:e:r:e'. " right
> after the command right ???
>
> - thanks & take care M.D.
>
> <aka>
> _ _
> | |_ ___ _ __ ___ __ _ | |_ ___ ___
> | __| / _ \ | '_ ` _ \ / _` | | __| / _ \ / _ \
> | |_ | (_) | | | | | | | | (_| | | |_ | (_) | | __/
> \__| \___/ |_| |_| |_| \__,_| \__| \___/ \___|
>
>
>
|
|
|
|
|