>
> use strict;
> use warnings;
> use Tie::File;
>
> my @array;
> tie @array, 'Tie::File', FILENAME or die "Couldn't open file: $!"
>
> unshift @array, <<'END_PREPEND';
> ENTHDR|1|3.0
> STAGEHDR|Barcoded
> END_PREPEND
>
Haven't tested it, but it should work.
http://perldoc.perl.org/Tie/File.html
; 4. "use strict;" and "use warnings;".
> >
> > 5. Still uses the "-w" flag.
>
> The steve's mail, in this thread, said the following:
>
> "I need to add 2 lines to a file and add the following text.
>
> ENTHDR|1|3.0
> STAGEHDR|Ba
Shlomi,
On Fri, Jan 21, 2011 at 12:13 PM, Shlomi Fish wrote:
> Hi Ary,
>
> On Friday 21 Jan 2011 16:01:36 Ary Kleinerman wrote:
> > A simple way:
> >
> > #!/usr/bin/perl -w
> > open FILE, ">>file.txt";
> > print FILE "line1\n";
> > print FILE "line2\n";
> > print FILE "ENTHDR|1|3.0\n";
> > print
Hi Ary,
On Friday 21 Jan 2011 16:01:36 Ary Kleinerman wrote:
> A simple way:
>
> #!/usr/bin/perl -w
> open FILE, ">>file.txt";
> print FILE "line1\n";
> print FILE "line2\n";
> print FILE "ENTHDR|1|3.0\n";
> print FILE "STAGEHDR|Barcoded\n";
> close FILE;
>
This script will *append* 4 lines to
Hi Steve,
On Thursday 20 Jan 2011 20:57:50 steve1040 wrote:
> I need to add 2 lines to a file and add the following text.
>
> ENTHDR|1|3.0
> STAGEHDR|Barcoded
>
> I don't have any idea how to do this in Perl
>
In UNIX and UNIX-like systems (including Windows), it is useful to think of a
file
A simple way:
#!/usr/bin/perl -w
open FILE, ">>file.txt";
print FILE "line1\n";
print FILE "line2\n";
print FILE "ENTHDR|1|3.0\n";
print FILE "STAGEHDR|Barcoded\n";
close FILE;
On Thu, Jan 20, 2011 at 3:57 PM, steve1040 wrote:
> I need to add 2 lines to a file and add the following text.
>
> E
I need to add 2 lines to a file and add the following text.
ENTHDR|1|3.0
STAGEHDR|Barcoded
I don't have any idea how to do this in Perl
Thanks
Steve
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/