in reply to Read() -Multiple Files-
Simple way
#!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); exit( 0 ); sub Main { my( $directory ) = @_; my $dbh = ...; for my $file ( GetFiles( $directory ) ){ LogFromPcap( $file, $dbh ); } $dbh->disconnect; } sub GetFiles { use Cwd(); my $cwd = Cwd::cwd(); chdir $directory or die $!; my @files = glob '*.pcap'; chdir $cwd; return @files; } sub LogFromPcap { my( $file, $dbh ) = @_; ... }
See File::Glob and File::Find::Rule (and search perlmonks for examples of each)
For getopt example see Re: help with loop
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Read() -Multiple Files-
by jboy4 (Initiate) on Jan 26, 2012 at 17:20 UTC | |
by Anonymous Monk on Jan 27, 2012 at 09:03 UTC | |
by Anonymous Monk on Jan 27, 2012 at 14:14 UTC | |
by Anonymous Monk on Jan 27, 2012 at 16:27 UTC |