Hi folks,
I'm writing a little applet to archive call data records. I need to process many files and filter their contents before placing the desired data into an archive file.
I've created an array and imported the file contents and used "foreach" to loop through the "line" printing it to an output file. I'd like to "filter" the contents in the
print statement but can't get it to work. My code looks like this:
#!c:/perl/bin/perl.exe -w
use strict;
use diagnostics;
open OUTPUT,"<","c:\/Perl\/Project\/Files\/SMDR.log.prs.20090220_08423
+0.prd"
or die "Couldn't open smdr file; $!\n";
my @lines = <OUTPUT>;
#loop through the array values and print each
foreach my $lines (@lines)
{
open (OUTFILE, ">>c:\/perl\/project\/archive.txt");
print OUTFILE "$lines"; #here's where I'd like to filter out any lines
+ containing "/" a slash character
close OUTFILE;
}
I confess I'm somewhat new to perl but I've searched for days now for an example that works and have had no luck.
Perhaps I'm going about it the wrong way.
I'd appreciate any comments.
Regards,
Generator