Copyright © tutorialspoint.com

PERL readpipe Function


Syntax

readpipe EXPR


Definition and Usage

Executes EXPR as a command. The output is then returned as a multiline string in scalar text, or with the line returned as individual elements in a list context.

Return Value

  • Returns in Scalar Context: String

  • Returns in List Context: List

Example

Try out following example:

#!/usr/bin/perl -w

@result = readpipe( "ls -l /tmp" );

print "@result";

It will produce following results: This will give whole content in /tmp directory.

 drwxr-xr-x  2 root   root    4096 Mar 19 11:55 testdir

Copyright © tutorialspoint.com