CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [oldrob] modifying a program to open all files in a directory: Edit Log



Chris Charley
User

Mar 13, 2013, 5:54 PM


Views: 360
Re: [oldrob] modifying a program to open all files in a directory


Code
chomp(@buffer = <$fh>); #copy the entire line to @buffer

This doesn't copy line 3 to @buffer. It copies lines 3 to eof to the buffer.

Update: Ok, I guess thats what you want the program to do - sorry.

You can use the glob function to get files like below.

Code
my $dir = shift @ARGV; 
my @cvs_files = glob "$dir/*.csv";

You would just need to specify your directory on the command line immediately after the program, like perl my_program.pl dir_name


(This post was edited by Chris Charley on Mar 14, 2013, 8:59 AM)


Edit Log:
Post edited by Chris Charley (User) on Mar 13, 2013, 5:57 PM
Post edited by Chris Charley (User) on Mar 14, 2013, 8:59 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives