Tuesday, 15 October 2019

How to run Linux Command Using Perl?

Method 1:

@a=print readpipe( "ls -l *" );

print @a;


Method 2:

@a=print system( "ls -l *" ); print @a;



Method 3:

open(my $file, '|-', "ls -l *.txt"); print $file;


Method 4:

@a=`ls -l *`; print "$a[3]";


Method 5:

@a=qx/ls -l */; print "$a[0]";


Method 6:
[execute exec at last]

exec(" ls -l *");



Labels:

0 Comments:

Post a Comment

Note: only a member of this blog may post a comment.

<< Home