SPUG: sending emails

Jacinta Richardson jarich at perltraining.com.au
Wed Feb 21 22:39:55 PST 2007


Michael R. Wolf wrote:

> You localized, but did not change, the input record separator.  Try:
> 
>     use English qw(-no_match_vars);
>     my $content = do { local $INPUT_RECORD_SEPARATOR = undef; <$xml_fh>; }

Localising a variable automatically sets it to undefined.  If you don't want
this behaviour you have to explicitly say:

	local $/ = $/;

You can test this theory with the following:

perl -we '$/ = 1; { local $/; print "[$/]" } print "[$/]"';
Use of uninitialized value in concatenation (.) or string at -e line 1.
[][1]
perl -we '$/ = 1; { local $/ = $/; print "[$/]" } print "[$/]"';
[1][1]

Of course there's no harm in setting it to undef yourself, but it's important to
know that not setting it to undef still changes it anyway.

> Of course, you could use non-english, and keep it at $/ (or is it $\? -- are
> you sure?).  The important part is to set it to undef.

I'm definately sure.  I just remember I|O (as in File IO)
	* for the _input_ record separator any drop of water from about will flow
towards the I: / .
	* for the _output_ record separator, a drop of water will flow towards the O: \  .

Works for me.

	J

-- 
   ("`-''-/").___..--''"`-._          |  Jacinta Richardson         |
    `6_ 6  )   `-.  (     ).`-.__.`)  |  Perl Training Australia    |
    (_Y_.)'  ._   )  `._ `. ``-..-'   |      +61 3 9354 6001        |
  _..`--'_..-_/  /--'_.' ,'           | contact at perltraining.com.au |
 (il),-''  (li),'  ((!.-'             |   www.perltraining.com.au   |


More information about the spug-list mailing list