Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 taking refuge in the Monastery: (9)
As of 2015-07-29 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls