Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 perusing the Monastery: (12)
As of 2015-07-31 12:37 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 (277 votes), past polls