[Israel.pm] mangled $_

Mikhael Goikhman migo at homemail.com
Thu Dec 23 07:15:16 PST 2004


On 23 Dec 2004 16:58:58 +0200, Jason Friedman wrote:
> 
> I am using a CPAN module, Text::Capitalize (it properly capitilizes
> titles), but it "mangles" my $_. To get around it, I am doing:
> 
>   my $underscore = $_; 
>   my $cap_title = capitalize_title($1,PRESERVE_ALLCAPS => 1); 
>   $_ = $underscore;
> 
> Is there a better way of doing this or at least being warned?

Your solution is acceptable. A better way would be to fix
Text::Capitalize, i.e. replace this line:

  $_ = $word;

with:

  local $_ = $word;

Regards,
Mikhael.

-- 
perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'



More information about the Perl mailing list