kaka_2 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I want to execute a command using open which is using "|" inside it. Sample command is "ls -ltr /tmp | wc -l".
i wrote the simple codes as below.
#!/usr/bin/perl use warnings; my $cmd = "ls -ltr | wc -l"; open (CCCC, "$cmd |") || die "Failed: $! \n"; close CCCC;
and now i get a exception "Broken pipe". Can someone help me with it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: execute a command using OPEN
by zentara (Cardinal) on Sep 10, 2014 at 14:48 UTC | |
|
Re: execute a command using OPEN
by ikegami (Patriarch) on Sep 10, 2014 at 15:25 UTC | |
|
Re: execute a command using OPEN (broken pipe)
by tye (Sage) on Sep 10, 2014 at 14:48 UTC | |
|
Re: execute a command using OPEN
by parv (Parson) on Sep 10, 2014 at 14:44 UTC |