in reply to Re^4: Sorting names using Regular Expressions and placing them in different Files.
in thread Sorting names using Regular Expressions and placing them in different Files.
It's not too polite to expect us to read your code like that, and it sounds an awful lot like this is a homework assignment that you want us to do for you. So, no, I don't think I'll rewrite your entire script for you. However, here's the key pieces you are missing:
Open a file for readingOpen a file for writingopen(INPUT,'<',$filename) or die $!;
Loop through a file looking for dates and namesopen(BSC,'>','BSC') or die $!;
There are some other problems with the variables in your code, putting "use strict" at the top and defining variables with "my $var = ..." would help.for my $searchline(<INPUT>) { if( $searchline =~ /20041204/ ) { if( $searchline =~ /^BSC/) { print BSC $searchline; } } }
|
|---|