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

Re: Extract string after removing the substring

by Athanasius (Chancellor)
on Oct 24, 2012 at 15:31 UTC ( #1000658=note: print w/replies, xml ) Need Help??

in reply to Extract string after removing the substring

Here’s another way:

If you don’t need the original string anymore, just give an empty string as the REPLACEMENT argument to substr:

1:26 >perl -E " $string = qq[ATATTTATATTAT]; say $string; $removed = +substr($string, 0, 3, q[]); say $removed; say $string; " ATATTTATATTAT ATA TTTATATTAT 1:30 >

Hope that helps,

Athanasius <°(((><contra mundum

Replies are listed 'Best First'.
Re^2: Extract string after removing the substring
by viktor (Acolyte) on Oct 24, 2012 at 15:37 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000658]
[stevieb]: agreed. That's why I said at least a half-dozen. If enough of the different formats are present, the date/time folk may not have to request more. If they do, then at least there was a decent base to start with
[stevieb]: I do date and time transformations in both Perl and Python, but not frequently enough to not have to search for the format params etc ;)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2017-04-29 02:42 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.