Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: passing token output to a variable

by frozenwithjoy (Curate)
on Jan 06, 2013 at 04:50 UTC ( #1011830=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    use strict;
    ...
    original: This     is        a string with   variable     numbers   of
    +    spaces.
    cleaned:  This is a string with variable numbers of spaces.
    # of substitutions: 6
    
  2. or download this
    my $cleaned = $token->as_is;
    $cleaned =~ s/\s{2,}/ /g;  # I took out the /s modifier. I thought it 
    +was only for transliteration (e.g., $cleaned =~ tr/ //s).
    
  3. or download this
    my $cleaned = $token->as_is =~ s/\s{2,}/ /gr;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2014-12-26 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (168 votes), past polls