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
In reply to Re: Read() -Multiple Files-
by Anonymous Monk
in thread Read() -Multiple Files-
by jboy4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |