Open perl
From Teknologisk videncenter
Contents
Piping from Perl to system commands
Getting STDOUT from commands
Metode 1
#!/usr/bin/env perl
print "Jeg er et perl program\n";
open FH,"ls -l|";
foreach my $i (<FH>) {
print "Har modtaget linien: $i";
}
Metode 2
#!/usr/bin/perl
my @files = `ls -l`;
for my $i (@files) {
print "Der er $i\n";
}