Prev: How to generate random number without replacement?
Next: FAQ 4.76 How do I verify a credit card checksum?
From: RedGrittyBrick on 2 Jun 2010 11:55 On 02/06/2010 16:08, chad wrote: > On Jun 1, 10:22 am, Martijn Lievaart<m...(a)rtij.nl.invlalid> wrote: >> On Tue, 01 Jun 2010 02:26:59 -0700, Peng Yu wrote: >>> On Jun 1, 3:24 am, Martijn Lievaart<m...(a)rtij.nl.invlalid> wrote: >>>> On Mon, 31 May 2010 20:47:22 -0700, Peng Yu wrote: >>>>> diff can take two input streams in the following example (if my >>>>> interpretation is correct). >> >>>>> diff<(gunzip<a.gz)<(gunzip b.gz) >> >>>>> I'm wondering how to take two streams in a perl program. >> >>>> This has nothing to do with diff or with perl, it's a function of your >>>> shell. So it works the same for diff as for perl. >> >>> I think that I understand what you mean.<(cmd) is just like a filename, >>> right? >> >> It actually gets passed to your program as a filename, although it really >> is a pipe to the command between the brackets. >> >> [martijn(a)cow t]$ perl -e 'print "@ARGV\n"'<(cat t.pl)<(cat t.pl~) >> /proc/self/fd/63 /proc/self/fd/62 >> [martijn(a)cow t]$ >> > > Why do you use the brackets in '<(cmd)'? Ie, why can't you just do > something like '<cmd' ? Because the shell would look for a data file named 'cmd' in the current directory and would not execute it as a command. $ wc -l <ls -bash: ls: No such file or directory $ wc -l <(ls) 105 /dev/fd/63 -- RGB
First
|
Prev
|
Pages: 1 2 3 Prev: How to generate random number without replacement? Next: FAQ 4.76 How do I verify a credit card checksum? |