in reply to Re^3: Sorting names using Regular Expressions and placing them in different Files.
in thread Sorting names using Regular Expressions and placing them in different Files.

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on Re^4: Sorting names using Regular Expressions and placing them in different Files.

Replies are listed 'Best First'.
Re^5: Sorting names using Regular Expressions and placing them in different Files.
by jZed (Prior) on Dec 28, 2006 at 18:30 UTC
    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.
Re^5: Sorting names using Regular Expressions and placing them in different Files.
by ikegami (Patriarch) on Dec 28, 2006 at 18:18 UTC

    Meanwhile, I am sure, you might have seen my code in my second posting.

    No, that was unreadable too.
    Please put para tags (<p>...</p>) around your paragraphs.
    Please put code tags (<c>...</c>) around your code.

    A reply falls below the community's threshold of quality. You may see it by logging in.