Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Loop Through Files and Update Headers

by kcott (Archbishop)
on Mar 06, 2020 at 06:58 UTC ( [id://11113901]=note: print w/replies, xml ) Need Help??


in reply to Loop Through Files and Update Headers

G'day jalopez453,

As has already been mentioned, you've some problems in your code. Another, is "untie @array" inside the for loop: indenting your code probably would have made that more obvious.

If you have a different number of new headers than what was there originally, consider using splice. Here's a quick example:

$ perl -E ' my @x = qw{H-old ...}; say for @x; splice @x, 0, 1, qw{H-new1 H-new2}; say for @x; ' H-old ... H-new1 H-new2 ...

— Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-23 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found