Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: substr and strings on the outside

by OeufMayo (Curate)
on Aug 19, 2001 at 20:23 UTC ( #106035=note: print w/replies, xml ) Need Help??

in reply to substr and strings on the outside

I'm not sure I perfectly understood what you wanted to do. Do you want to append '12345' to the $f variable, with at least 5 spaces at the beginning?

If so, here's a snippet that should do what you want:

sub pad { my ($spaces, $string) = @_; return( " " x (5 - length $spaces) . $string ); } my $add = "12345"; my $f = " " x 4; # for leading spaces smaller than 5 print "[" . pad( $f, '12345') . "]";
my $OeufMayo = new PerlMonger::Paris({http => ''});</kbd>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://106035]
[choroba]: I configured signature font to 2pt size, so I don't care
[choroba]: Moreover, I don't find the Big Lebowski quote offensive
Lady_Aleena wishes she could format her signature a bit without getting metaphorical hives.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-06-23 09:15 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (539 votes). Check out past polls.