Re: Help me with a regex problem

2019-10-25 Thread X Dungeness
my $n = '[0-9]{1,3}'; if ( =~ ( m[ (?:$n\.){3} $n \s+ \S+ ]x ) { # match } On Fri, Oct 25, 2019 at 3:37 AM Maggie Q Roth wrote: > what's V.*? > > Maggie > > On Fri, Oct 25, 2019 at 6:28 PM Илья Рассадин wrote: > >> For example, this regex >> >>

Re: Unescaped Left Brace

2017-11-23 Thread X Dungeness
Hm, that's a misbegotten quantifier. >From 5.26.0 perlreref: There is no quantifier "{,n}". That's interpreted as a literal string. On Thu, Nov 23, 2017 at 3:04 AM, Mike Flannigan wrote: > > I recently installed the latest version of > Strawberry Perl. My scripts were

Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'

2017-07-01 Thread X Dungeness
It's about what unary ! (bang operator) does to the operand Here's the dissonance: perl -E '$x=0; say "x=$x"; $x = !!$x; say "x=$x"' x=0 x= It behaves as you expect until you "bang" it twice. I found a good explanation in the Camel: "Unary ! performs logical negation, that is "not". The value

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-18 Thread X Dungeness
Hm, IIUC can't the remote script sleep-loop and send output back asynchronously. (More reseach needed on async piece).. $ssh->system('/path/to/remote_script arg, arg,...'); #!/bin/... # remote_script for (...); do get_temp_probe(); . ; sleep 300; done On Tue, Apr 18, 2017 at 6:19

Re: How to delete multiple indices from array

2017-04-12 Thread X Dungeness
Quite! Even the slowest may find redemption in clarity :) my @arr = qw( zero one two three ... ); my @del = qw( 2,4,... ); my( %del, @new ); @del{ @del } = (); for (0..$#arr) { push @new, $arr[$_] unless exists $del{$_}} On Wed, Apr 12, 2017 at 2:18 PM, Paul Johnson wrote: > On

Re: Changing date format using carpout

2017-03-26 Thread X Dungeness
amp"); On Sun, Mar 26, 2017 at 3:04 PM, X Dungeness <dery...@gmail.com> wrote: > Shawn may have a different take but I think the "local" is > misplaced and goes out of scope when the call's made. > > Here's a potential workaround: > > out of scope > >

Re: Changing date format using carpout

2017-03-26 Thread X Dungeness
Shawn may have a different take but I think the "local" is misplaced and goes out of scope when the call's made. Here's a potential workaround: out of scope On Sun, Mar 26, 2017 at 2:02 PM, SSC_perl wrote: >> On Mar 26, 2017, at 1:15 PM, Shawn H Corey

Re: Changing date format using carpout

2017-03-26 Thread X Dungeness
Certainly an inefficient, unwieldy solution if you're dealing with huge logfiles. May be problematic on non-Unix too but you could post-process the logfile in an END {} block eg, get rid of hr:min:ss part of timestamp for example: END { $^I = ''; @ARGV = qw( /path/to/error.log);

Re: Parsing web pages

2017-03-02 Thread X Dungeness
Take a look a WWW::Mechanize. The older web suite LWP is an alternative and that may be enough if you only need a specific item. LWP::Simple is a possibility to see if you can mine the info from the page. If there's more complexity, then LWP::UserAgent is a starting point. A couple of books too:

Re: multiple named captures with a single regexp

2017-03-01 Thread X Dungeness
On Wed, Mar 1, 2017 at 2:52 AM, Chas. Owens wrote: > Sadly, Perl will only capture the last match of capture with a qualifier, so > that just won't work. The split function really is the simplest and most > elegant solution for this sort of problem (you have a string with a

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread X Dungeness
On Sat, Nov 5, 2016 at 10:55 AM, Jovan Trujillo wrote: > Hi Aaron, >In perlre I read that \w > " > > \w[3] Match a "word" character (alphanumeric plus "_", plus > other connector punctuation chars plus > Unicode >

Re: Re-exec in perl

2016-10-04 Thread X Dungeness
On Tue, Oct 4, 2016 at 2:07 PM, X Dungeness <dery...@gmail.com> wrote: > Here's a possibly relevant note in the docs for both "alarm" and > "sleep": > > It is usually a mistake to intermix "alarm" and "sleep" calls, >

Re: Re-exec in perl

2016-10-04 Thread X Dungeness
Here's a possibly relevant note in the docs for both "alarm" and "sleep": It is usually a mistake to intermix "alarm" and "sleep" calls, because "sleep" may be internally implemented on your system with "alarm". On Tue, Oct 4, 2016 at 1:34 PM, Chas. Owens

Re: Remove Newlines from String

2016-09-06 Thread X Dungeness
at 1:06 PM, Uri Guttman <u...@stemsystems.com> wrote: > On 09/06/2016 03:59 PM, X Dungeness wrote: >> >> $str = "ab\rcd\nef\ngh\fij"; >> >> $str =~ s{ ([^[:print:]]) }{ sprintf( "(%#2X)", ord $1) }gex; >> >> > ab(0XD)cd(0XA)e

Re: Remove Newlines from String

2016-09-06 Thread X Dungeness
$str = "ab\rcd\nef\ngh\fij"; $str =~ s{ ([^[:print:]]) }{ sprintf( "(%#2X)", ord $1) }gex; > ab(0XD)cd(0XA)ef(0XA)gh(0XC)ij On Tue, Sep 6, 2016 at 9:11 AM, Matt wrote: > I am receiving log entries as a string and then writing them to a file > with the