Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: tagging question

by beable (Friar)
on Jul 24, 2004 at 01:16 UTC ( #377053=note: print w/replies, xml ) Need Help??

in reply to Re: tagging question
in thread tagging question

I must not be a true perl master, because I hacked on your program and it got BIGGER!
#!/usr/bin/perl # you have to use strict and warnings unless you # have a really good reason not to. use strict; use warnings; my $string = "il asdfasdfasdf"; my $tag = ""; # use matching here instead of substitution # all of the string should appear in the output # also, don't need square brackets in match if ($string =~ m/(\S{2})/) { $tag = "<$1>"; } # you don't need to concatenate, just interpolate the lot $string = "$tag $string $tag"; print "string = $string\n"; __END__

Replies are listed 'Best First'.
Re^3: tagging question
by LassiLantar (Monk) on Jul 24, 2004 at 04:12 UTC
    I must not be a true perl master, because I hacked on your program and it got BIGGER!

    Gwuahaha! I am superior! (read: I am too lazy to write in use strict/use warnings on PM). I agree with you, use strict and warnings are totally necessary. I'm so lazy I even sometimes try to circumvent use strict by redeclaring my variables in random places, but really they're improving the way I write code. (As is sparring with the monks).


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2023-03-21 17:49 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.