Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: header footer

by Eily (Curate)
on Mar 04, 2014 at 23:01 UTC ( #1076995=note: print w/ replies, xml ) Need Help??


in reply to Re^2: header footer
in thread header footer

Yeah, I just missed the multiple records in the same file. Mea culpa

Then you can do something like:

%length = (HDR => 5, FTR => 10); while(<DATA>) { while(/(HDR|FTR)/) # find either HDR or FTR { substr($_, $-[1], $length{$1}) = ''; # $-[1] is the position of +the first capture groups (parenthesis) } print; } __DATA__ HDR--Hello this is a test FTR-------Should there be text here? HDR--Tw +o records on the same line FTR------- HDR--and here an incomplete footer FTR--


Comment on Re^3: header footer
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-07-07 02:50 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 (86 votes), past polls