Re: multilinepattern match

From: Anno Siegel (anno4000_at_lublin.zrz.tu-berlin.de)
Date: 11/18/03


Date: 18 Nov 2003 12:24:28 GMT

James Willmore <jwillmore@myrealbox.com> wrote in comp.lang.perl.misc:
> genericax@hotmail.com (Sara) wrote in message
> news:<776e0325.0311171042.1adbfb60@posting.google.com>...
> <snip>
> > #!/usr/bin/perl -wd
>
> Just a suggestion ...
> when posting code, please avoid using the '-d' switch. I realize that
> it throws one into the debugger, but others may not. Given the
> various states of experience in Perl found in this newsgroup, this
> could confuse the not so experienced reader.
>
> Again - just a suggestion :-)
>
> > $_ = "a bunch of
> > stuff
> > is here..
> > end;
> > /
> > thats all
> > folks";
>
> Another suggestion is avoid setting '$_'. It's a special variable and
> one should avoid setting it. Again - I understand what you're trying
> to demonstrate, but those less experienced may not.

There is nothing wrong with setting $_ in your main script when it's
handy (and it often is). Care must be taken when doing this in a
subroutine. Then you *must* localize $_ before setting it, or you're
in for some nasty surprise.

Anno



Relevant Pages

  • Re: multilinepattern match
    ... it throws one into the debugger, ... Again - just a suggestion :-) ... Another suggestion is avoid setting '$_'. ...
    (comp.lang.perl.misc)
  • Re: compilation problem with module function interface definition
    ... >> decimal floats start appearing, it would be wise for users to avoid ... > for numeric literals was a decimal KIND (as previously suggested ... I guess I sort of passed over that suggestion because I don't ...
    (comp.lang.fortran)
  • Re: (OT) Singing my same old sad song.
    ... they avoid the full text of what has been written, and claim the NEED to drive to work, ignoring such things as car pooling, making fewer trips to the store, shopping closer to home, and otherwise cutting back on miles driven. ... Nobody has suggested that anyone STOP driving, yet most of the responses have been dished out as though that WERE the suggestion. ...
    (rec.outdoors.rv-travel)
  • Re: How do I speed Up dataset.ReadXML????????
    ... Try my suggestion, using a text file where the separator is a control char, ... that avoid having to process the fields looking for ... embedded comma inside the values. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re[4]: [PHP] nested, referenced foreach & implicit current array pointer issues
    ... instead to avoid the reference, ... assignment. ... Yep, already did, 10x for the suggestion. ...
    (php.general)