Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by mr_mischief (Monsignor)
on Jan 03, 2007 at 17:31 UTC ( [id://592802]=note: print w/replies, xml ) Need Help??


in reply to Sorting names using Regular Expressions and placing them in different Files.

Does this:
#!/usr/bin/perl use strict; use warnings; my %files = ( 'BSC' => 1, 'SBSCSubsystem' => 1, 'MCBTSSubsystem' => 1 +); no strict 'refs'; ( open ( $$_, '>', $_ ) or die "$_: $!\n") for ( keys %files ); my ( $dest, $date ); while ( <> ) { ( $dest, $date ) = split /-/, ((split /\s+/)[8]); print "dest: $dest\n"; ( print ${$dest} ( $_ ) ) if exists $files{$dest}; }
do what you need? If not, please try to clearly state what part of your spec it does not meet and what needs to be changed.

Note: the preceeding code takes the input on STDIN or as a file named as the first argument.


Christopher E. Stith
  • Comment on Re: Sorting names using Regular Expressions and placing them in different Files.
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-19 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found