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

RE: pulling file name into perl

Thread Previous | Thread Next
From:
Hanson, Robert
Date:
January 31, 2002 12:22
Subject:
RE: pulling file name into perl
Message ID:
11A304418ECBAB498FBF10ABCEA5E499D1CDC9@hq2kax1.nj.aptegrity.com
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`;

Rob


-----Original Message-----
From: Russell Boyd [mailto:RBOYD@tnrcc.state.tx.us]
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?

Thanks,
Russell

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About