Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 avoiding work at the Monastery: (7)
As of 2014-08-28 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (256 votes), past polls