Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: small regex help

by sulfericacid (Deacon)
on Jun 17, 2006 at 00:35 UTC ( #555913=note: print w/ replies, xml ) Need Help??


in reply to small regex help

The following code is untested, but probably has a 90-95% chance of working.

#!/usr/bin/perl use warnings; use strict; open(LOG, "source.txt") or die "Error: $!"; my @lines = <LOG>; close(LOG); my $cnt = 0; foreach my $line (@lines) { $cnt++; $line =~ m/(\d+\s+)(.+)/; $lines[$cnt] = "$1 (Birthday) $2 - singer"; } open(LOG, "> source2.txt") or die "Error $!"; print LOG join("\n", @lines); close(LOG);


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid


Comment on Re: small regex help
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2015-07-05 18:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls