Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by jZed (Prior)
on Dec 28, 2006 at 12:55 UTC ( [id://592097]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

Please follow marto's advice and reformat both of your postings using code tags so that they are legible.
  • Comment on Re^3: Sorting names using Regular Expressions and placing them in different Files.

Replies are listed 'Best First'.
Re^4: Sorting names using Regular Expressions and placing them in different Files.
by Kiran Kumar K V N (Initiate) on Dec 28, 2006 at 13:08 UTC
    Hi jZed, I am trying to reformat my both the postings. Meanwhile, I am sure, you might have seen my code in my second posting. It seems vague and there is some real problem with it. I am not able to implement Regular Expressions Logic. Other things also seem to be messed up. As such, can you please explain the Logic you mentioned in your Algo by giving your own Actual Perl Script for the Scenario. Waiting for your aggressive response. Thanks and Regards, Kiran

      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.

        Hi jZed & Ikegami,

        I am trying to reformat my both the postings. Meanwhile, I am sure, you might have seen my code in my second posting. It seems vague and there is some real problem with it. I am not able to implement Regular Expressions Logic. Other things also seem to be messed up. As such, can you please explain the Logic you mentioned in your Algo by giving your own Actual Perl Script for the Scenario.

        Waiting for your aggressive response.

        Thanks and Regards,

        Kiran

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://592097]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.