Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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 ...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026843]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2018-06-20 12:14 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.