165

Executing External Commands
The Open Function

  • The open() function may be called with a trailing or leading pipe | symbol in order to

    • Read the output from one or more commands

        open( README, "ls -l |" );
        $line = <README>;

    • Write to the input of one or more commands

        open( WRITEME, "| Mail -s 'test' joe@foo.com" );
        print WRITEME "Dear John,\n";