Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^2: Space between digits

by Anonymous Monk
on Nov 21, 2012 at 21:28 UTC ( #1005014=note: print w/replies, xml ) Need Help??

in reply to Re: Space between digits
in thread Space between digits

I meant for that pattern and of date and time. I didnt mean that particular string. for example for the pattern
(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)
how do I triple the space between the time and date ?

Replies are listed 'Best First'.
Re^3: Space between digits
by tobyink (Abbot) on Nov 21, 2012 at 21:31 UTC

    The code I posted will work on any string. It finds the first space and replaces it with three spaces.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      The code you gave is not working I tried this
      if ($_ =~ m/(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)/ ){ my $string = "(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)"; my $new = $string =~ s/ / /; print "new $new "; }
        my $string = "(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)";

        What is the purpose of this line? Does it really help you to do what you want to? What happens if you leave it out entirely?

        s/// works in place (that is, on the variable it is bound to). What happens if you rewrite it as this:

        if ($_ =~ m/(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)/ ){ $_ =~ s/ / /; }

        And of course, m// and s/// works on $_ in lieu of any other variable, so you could even just go:

        if (m/(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)/ ){ s/ / /; }

        Which could be shortend to:

        s/ / / if m/(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)/;

        Those parens serve no purpose, as you're seemingly not capturing anything, so we can be even more briefer without harming readability:

        s/ / / if m/\d+\:\d+ \d+\/\d+\/\d+/;

        You tried that. That is not working. But that is not the code I posted.

        perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005014]
[Discipulus]: ..or inspect the source code of the module
[makita]: I am doing this:
[makita]: my $sig = $wss->signature( schema => $wsdl, token => $token, sign_types=>'wsa: Action','wsa:To', 'wsu:Timestamp', 'wsa:MessageID',' SOAP-ENV:Body', signer=>DSIG_RSA_S HA1, public_key => $cert,
[Corion]: Oof, I haven't done much with signing SOAP requests. markov is usually somebody good to ask via mail ;)
[makita]: I need to create a SOAP call where are signed more types not only the body
[makita]: I am inspecting it second day :)
[makita]: Thanks
[Discipulus]: better to ask a full SOPW
erix self-flagellates with the cluebat
[erix]: indeed had to be( time make check-world ) > test_run2.output 2>&1

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2017-03-23 08:49 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (285 votes). Check out past polls.