develooper Front page | perl.beginners | Postings from January 2002

RE: pulling file name into perl

Thread Previous | Thread Next
Hanson, Robert
January 31, 2002 12:22
RE: pulling file name into perl
Message ID:
Use backticks, not system().

$date = `ls -al | grep filename.txt`;

Or if you want it in an array like you mentioned, do this...

@date = `ls -al | grep filename.txt`;


-----Original Message-----
From: Russell Boyd []
Sent: Thursday, January 31, 2002 3:17 PM
To: <
Subject: pulling file name into perl

I am wanting to get a unix directory file listing and put it into a Perl
array. I attempted

$date = system "ls -al | grep filename.txt";

However all this did was send it to <STDOUT>.

What am I missing?


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About