Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: passing token output to a variable

by frozenwithjoy (Priest)
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 drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2016-10-01 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (7 votes). Check out past polls.