[25917] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8141 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 2 00:05:24 2005

Date: Wed, 1 Jun 2005 21:05:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 1 Jun 2005     Volume: 10 Number: 8141

Today's topics:
        Perl: Win-32 vs. linux <maqo@yahoo.com>
    Re: Suppression of error messages if a regex does not m <comdog@panix.com>
    Re: Suppression of error messages if a regex does not m <comdog@panix.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 02 Jun 2005 03:47:02 GMT
From: Maqo <maqo@yahoo.com>
Subject: Perl: Win-32 vs. linux
Message-Id: <Wivne.3079$jU5.1365201@twister.nyc.rr.com>

Is there any reason the following would work on a linux installation of 
Perl, but not using ActivePerl-5.8 on a Win-32 system?  The tr/// 
operation successfully removes UTF-8 encoded &nbsp; characters from the 
string in linux, but not Win-32, even after verifying that all required 
modules are installed.  Any thoughts would be greatly appreciated!

-----------------------------------------------------------------------

use LWP::Simple;
use Encode;

my $URL =
"http://www.pimco.com/LeftNav/Late+Breaking+Commentary/IO/2004/IO_07_04.htm";

$content = get($URL);
$decoded = decode("utf-8"=>$content);
$decoded =~ tr/\x{00a0}/ /;

print $decoded;




------------------------------

Date: Wed, 01 Jun 2005 19:31:40 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Suppression of error messages if a regex does not match
Message-Id: <010620051931400821%comdog@panix.com>

In article <429dd802$0$25045$8fcfb975@news.wanadoo.fr>, Mark Clements
<mark.clementsREMOVETHIS@wanadoo.fr> wrote:

> David Joseph Bonnici wrote:
> 
> > Whenever I have a capture group that does not produce a match I am getting
> > loads of 
> > "Use of unitialized valie in string ne at "
> > Is there a way how I can suppress these error messages.

> You should always be testing for a successful match before using the captured
> match variables.

A successful match can still produce undefined memory variables, and 
this warning. In this example, the match succeeds, but only $1 and
$3 get a value because the $2 portion was optional. Using $2 produces
a warning.

   #!/usr/bin/perl -w

   if( "foo bar" =~ m/(foo)\s+(baz)?(bar)/ )
      {
      print "1: $1\n2: $2\n3: $3\n";
      }

With more recent perls, we can turn off classes of warnings, if we
wanted, for any particular scope.

   no warnings 'uninitialized';

I'm more likely to be old-school when I want to turn off warnings
because some clients still deal with older perls:

   local $^W = 0;

-- 
brian d foy, bdfoy@cpan.org
Subscribe to The Perl Review: http://www.theperlreview.com


------------------------------

Date: Wed, 01 Jun 2005 19:38:34 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Suppression of error messages if a regex does not match
Message-Id: <010620051938345662%comdog@panix.com>

In article <Pine.LNX.4.62.0506011735290.12211@ppepc56.ph.gla.ac.uk>,
Alan J. Flavell <flavell@ph.gla.ac.uk> wrote:



> Anyone who advises turning warnings off to hide the warning may be 
> technically accurate about what Perl does or can do - but 
> operationally it's a disaster. 

Well, I don't think it's always an operational disaster. I think
warnings are something we can use to understand what the code is
doing. When we know what it is doing and accept that in some cases
we know better than perl, turning off warnings is not a disaster.

I generally advise people to turn off warnings in production scripts.
Turn on warnings in development and debugging, but don't fill your
disk with warning messages just because someone upgraded perl (and
the new perl has a different idea about warnings). I've had clients
run out of disk space from that (back in the days before Gb was
a common measurement) situation, and those were minor disasters.

perl doesn't always know best. :)

-- 
brian d foy, bdfoy@cpan.org
Subscribe to The Perl Review: http://www.theperlreview.com


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8141
***************************************


home help back first fref pref prev next nref lref last post