Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Regex Split and Formatting

by reaper9187 (Scribe)
on Apr 03, 2013 at 12:09 UTC ( #1026843=note: print w/ replies, xml ) Need Help??


in reply to Regex Split and Formatting

Thank you so much for the prompt reply ...
I did try using regex but failed miserably.. I got thus far :

$out_file = "testout.txt"; #this is the file to be edited open (OUT, "<$out_file") or die "Can't open $out_file: $!\n"; $/ = "\n"; while ($line = <OUT>) { my $first = (split /,/, $line)[0]; $first =~ tr/"//d; $first =~ s/^\s+//; ....... } close OUT;
*Tried to use the first numeric element as matching criteria and the split that line into an array(but that got way too complicated)
* Then tried using splice to split the entire file into equal sized arrays( but i did not know how to do that)

I did not know how to proceed(hence the "...." in the code) The method i'm using is long (since I'm a newbie to perl and don't understand all the nuances)..Appreciate the help ..

P.S: This is not my homework.. Just something i'm working on currently ...


Comment on Re: Regex Split and Formatting
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (13)
As of 2014-07-10 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (215 votes), past polls