T
thorassic5
Im trying to read a series of files and extract a small, unique piece
of data from each of them, and print it in a log file. grep didnt
seem to be working as i expected, until i realized that the files
werent being opened, and my regex was banging against the <i>names</i>
of the files. heres what i have,
#!/usr/bin/perl
opendir(DIR, ".");
my @files = glob "*.txt";
closedir(DIR);
open(OUT, ">log.log");
foreach $file (@files){
my @user = grep{!/inventory\d{6}/} $file;
print OUT "$_ \n";
}
close OUT;
Where have i led myself astray?
Thanks!
of data from each of them, and print it in a log file. grep didnt
seem to be working as i expected, until i realized that the files
werent being opened, and my regex was banging against the <i>names</i>
of the files. heres what i have,
#!/usr/bin/perl
opendir(DIR, ".");
my @files = glob "*.txt";
closedir(DIR);
open(OUT, ">log.log");
foreach $file (@files){
my @user = grep{!/inventory\d{6}/} $file;
print OUT "$_ \n";
}
close OUT;
Where have i led myself astray?
Thanks!