[Israel.pm] Doing it the perlish way

Yossi.Itzkovich at ecitele.com Yossi.Itzkovich at ecitele.com
Thu Jun 8 11:55:36 PDT 2006


Thanks again.

Yossi


perl-bounces at perl.org.il wrote on 08/06/2006 21:52:58:

> On Thu, Jun 08, 2006 at 21:47:35 +0300, Yossi.Itzkovich at ecitele.com
wrote:
>
> > I don't think it's more perlish, but anyhow if I don't need the
advantages
> > of use warnings (such as "no warnings") I think that -w is better.
> > ...
>
> It's just my habit =)
>
>
> > Why  do you prefer 3-arguments open ?
>
> Because sometimes the file name might have funny characters in it,
> and I think it's ugly that perl has to parse the file name to figure
> out what mode I'm opening it in.
>
> > > chomp for @dict; # trim the newlines
> > What for ?
>
> Because it's a list of words, not a list of lines as I see it...
> Maybe that's just me
>
> > I agree it's nice, and it's "descriptive writing", but especially in
Perl
> > the common way is not to close file handles, unless needed.
>
> I optimize for readability no matter how/what I write. I don't like
> spending more time than necessary figuring out what it is I wrote 2
> years ago, especially if it's a module I have to maintain, but also
> if it's a script i don't want to waste too much time on.
>
>
> > >    my $pat = qr/$_/; # qr is both faster and more informative
> > Why is it faster, and why more informative ?
>
> Faster: the pattern is precompiled by perl, not recompiled again for
> every word in @dict.
>
> More informative: when stringified, compiled regexes will show the
> (?ixsm-:) type flags so you can know exactly what the pattern is
>
> > >     print STDERR "pat=$pat"; # go to STDERR so that it doesn't wind
up
> > in pipes
> > I agree.  In this case why not using warn ?
>
> I usually use warn with a new line at the end, but people tend to
> not like it, so in fact I lied, and I *would* have used warn ;-)
>
> --
>   Yuval Kogman <nothingmuch at woobling.org>
> http://nothingmuch.woobling.org  0xEBD27418
>
> [attachment "attn6ys3.dat" deleted by Yossi Itzkovich/ECI Telecom]
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl




More information about the Perl mailing list