The find here can be any command. A trailing pipe '|' makes perl pipe the output of command into your script as input(with filehandle specified). A leading pipe before the command will make any output written by your Perl code to the filehandle appear as standard input to the command.#!/usr/bin/perl use strict ; use warnings ; open(CMDOPT, "find /path -type d | ") or die("$! : cant execute find") + ; while(<CMDOPT>) { print "Directory found : $_" ; ##do something with the directory here..... }
In reply to Re: piped AND prompted input
by manav
in thread piped AND prompted input
by bemfica
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |