Re: FAQ 8.28 How can I call backticks without shell processing?
- From: Uri Guttman <uri@xxxxxxxxxxxxxxx>
- Date: Fri, 04 Jul 2008 16:38:34 GMT
"s" == szr <szrRE@xxxxxxxxxxxxxxx> writes:
s> Uri Guttman wrote:
>>>>>>> "s" == szr <szrRE@xxxxxxxxxxxxxxx> writes:
>> perl -e '@e = qw( a b c ); open( $e, "-|", 'echo', @e ); print <$e>'
>> a b c
>>
>> echo printed its args with spaces as expected so it got 3 separate
>> args and not 'abc' as you claim it would.
s> Curious, I thought the behavior would be like:
s> $ perl -e '@e = qw( a b c ); print @e'
s> which yields 'abc', as I saw that after the first three arguement of the
s> normal 3 arg open() it appeared to take a list of additional args that
s> is passes to what ever you opened. I didn't know it separates them like
s> it does. Good to know.
you don't get what is happening there. perl is printing each element and
there is no separator so it appears you are concatenating. when you exec
with a list each argument is separated in the same way and it depends on
the exec'ed program how they will be used. echo puts spaces between them
which is why i chose that for the one liner. i could have used perl
again and it would not have put spaces in unless i made it do so (as
with "@e").
uri
--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
.
- Follow-Ups:
- References:
- FAQ 8.28 How can I call backticks without shell processing?
- From: PerlFAQ Server
- Re: FAQ 8.28 How can I call backticks without shell processing?
- From: szr
- Re: FAQ 8.28 How can I call backticks without shell processing?
- From: Uri Guttman
- Re: FAQ 8.28 How can I call backticks without shell processing?
- From: szr
- FAQ 8.28 How can I call backticks without shell processing?
- Prev by Date: Re: Formatting ASCII to be read by Windows NotePad
- Next by Date: Re: Formatting ASCII to be read by Windows NotePad
- Previous by thread: Re: FAQ 8.28 How can I call backticks without shell processing?
- Next by thread: Re: FAQ 8.28 How can I call backticks without shell processing?
- Index(es):
Relevant Pages
|