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.

Hi Kiran,

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 reading
open(INPUT,'<',$filename) or die $!;
Open a file for writing
open(BSC,'>','BSC') or die $!;
Loop through a file looking for dates and names
for my $searchline(<INPUT>) { if( $searchline =~ /20041204/ ) { if( $searchline =~ /^BSC/) { print BSC $searchline; } } }
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.