Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Regular expression help required

by bichonfrise74 (Vicar)
on Oct 22, 2009 at 20:34 UTC ( [id://802794]=note: print w/replies, xml ) Need Help??


in reply to Regular expression help required

Try this.
#!/usr/bin/perl use strict; my (%record, $key); while (<DATA>) { chomp; if ( /^[A-Z]/ ... /]\n[A-Z]/ ) { ($key) = /(\S+)/ if ( /^[A-Z]/ ); push( @{ $record{$key} }, $_ ) if ( !/^[A-Z]/ ); } } print "$_: @{ $record{$_} }\n" for ( keys %record ); __DATA__ TxNum Band: 3 [10-30] [50-80] [100-200] RxNum Band: 3 {100-120} [120-300] [400-600] [800-1000] Others: 2000

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://802794]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (None)
    As of 2024-04-18 23:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found