perlpal has asked for the wisdom of the Perl Monks concerning the following question:
My requirement is to insert content (an array of variables to be more specific) into a file at the location with the place holder "USER NOTE".
I have tried to use TIE::File but seem to be missing out on something pretty fundamental as it does not work for me currently.
Excerpt of the perl code that i am using
tie my @lines, 'Tie::File', $ut_fh;#$ut_fh is a file handle for (@lines) { if (/.*USER\s+NOTE.*/i){ $_ .= "\n@$global_variables_list\n"; last; } }
Note : the file handle is opened in the following mode "+>>".
The above code snippet causes my script to hang.
Thanks in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Inserting content into a file at a particular location
by JavaFan (Canon) on Aug 25, 2010 at 09:32 UTC | |
by Corion (Patriarch) on Aug 25, 2010 at 09:38 UTC | |
by perlpal (Scribe) on Aug 25, 2010 at 09:50 UTC | |
by JavaFan (Canon) on Aug 25, 2010 at 10:00 UTC | |
|
Re: Inserting content into a file at a particular location
by murugu (Curate) on Aug 25, 2010 at 06:16 UTC | |
by perlpal (Scribe) on Aug 25, 2010 at 09:15 UTC |