Shlomi,

On Fri, Jan 21, 2011 at 12:13 PM, Shlomi Fish <[email protected]> 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 FILE "STAGEHDR|Barcoded\n";
> > close FILE;
> >
>
> This script will *append* 4 lines to "file.txt" - not prepend them and
> furthermore does not use:
>
> 1. Three args open.
>
> 2. Lexical filehandles.
>
> 3. or die after an open.
>
> 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|Barcoded"

So... my code do exactly that.



As a result it suffers from many bad practices. See:
>
> http://perl-begin.org/tutorials/bad-elements/
>
> I only showed the idea of the code. It's assumed that echo one should
improve it. This is the idea. But thats for this URL. I didn't know it and
It's very useful.



> From where did you learn Perl that you recommend writing such crude code?
>
>
>From the street :P


> Regards,
>
>        Shlomi Fish
>
> > On Thu, Jan 20, 2011 at 3:57 PM, steve1040 <[email protected]>
> 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
> > >
> > > Thanks
> > > Steve
> > >
> > >
> > > --
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > > http://learn.perl.org/
>
> --
> -----------------------------------------------------------------
> Shlomi Fish       http://www.shlomifish.org/
> Best Introductory Programming Language - http://shlom.in/intro-lang
>
> Chuck Norris can make the statement "This statement is false" a true one.
>
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>

Reply via email to