Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

(elbie): substr and strings on the outside

by elbie (Deacon)
on Aug 19, 2001 at 20:20 UTC ( #106033=note: print w/ replies, xml ) Need Help??


in reply to substr and strings on the outside

Regex search and replace:

my $f = " "; $f =~ s/^(.{0,5}).{0,5}/${1}12345/;

The only problem is this regex doesn't pad extra spaces if your string is too short, but at least it still does the replacement.

elbieelbieelbie


Comment on (elbie): substr and strings on the outside
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2015-07-06 07:42 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 (70 votes), past polls