Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: A little win

by jwkrahn (Monsignor)
on Oct 19, 2011 at 07:25 UTC ( #932313=note: print w/replies, xml ) Need Help??


in reply to A little win

:'<,'>!perl -pe 'chomp; $_ =~ s/[<>]*//g; $_ = join "", map { chr $_ } + split ",", $_'

Could be written more simply and efficiently as:

:'<,'>!perl -pe 'chomp; tr/<>//d; $_ = join "", map chr, split /,/'

Replies are listed 'Best First'.
Re^2: A little win
by anneli (Pilgrim) on Oct 19, 2011 at 07:47 UTC

    Combine that with tye's suggestion and we're down to:

    :'<,'>!perl -pe 'tr/<>//d; $_ = pack "C*", split ","'

        ... simplicity wins again.

      Please read perldoc -f split, as the first argument to split is usually a regex, not a string

      :'<,'>!perl -pe 'tr/<>//d;$_=pack"C*",split/,/'

      Enjoy, Have FUN! H.Merijn

        Good point! I'll try to remember this from now on.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://932313]
help
Chatterbox?
[holli]: i just keep spamming
[holli]: writing a cb client in operl 6

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2017-09-23 12:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (272 votes). Check out past polls.

    Notices?