[32748] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4012 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 11 03:09:45 2013

Date: Sun, 11 Aug 2013 00:09:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 11 Aug 2013     Volume: 11 Number: 4012

Today's topics:
        Help Review Perl Course <rdpguru99@gmail.com>
        Help Review Perl Course <rdpguru99@gmail.com>
        Help Review Perl Course <chiragsharma.guru99@gmail.com>
    Re: Help Review Perl Course <uri@stemsystems.com>
    Re: Help Review Perl Course <jurgenex@hotmail.com>
        s modifier doesn't seem to work fmassion@web.de
    Re: s modifier doesn't seem to work <hjp-usenet3@hjp.at>
    Re: s modifier doesn't seem to work <gravitalsun@hotmail.foo>
    Re: s modifier doesn't seem to work <ben@morrow.me.uk>
    Re: s modifier doesn't seem to work <ben@morrow.me.uk>
    Re: s modifier doesn't seem to work <hjp-usenet3@hjp.at>
    Re: s modifier doesn't seem to work fmassion@web.de
    Re: s modifier doesn't seem to work fmassion@web.de
    Re: s modifier doesn't seem to work <gravitalsun@hotmail.foo>
    Re: s modifier doesn't seem to work <derykus@gmail.com>
    Re: s modifier doesn't seem to work <ben@morrow.me.uk>
    Re: translate human-readable time shorthand <rweikusat@mssgmbh.com>
    Re: translate human-readable time shorthand <rweikusat@mssgmbh.com>
    Re: translate human-readable time shorthand (Tim McDaniel)
    Re: translate human-readable time shorthand (Seymour J.)
    Re: translate human-readable time shorthand (Tim McDaniel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 10 Aug 2013 02:01:51 -0700 (PDT)
From: Rohit Patel <rdpguru99@gmail.com>
Subject: Help Review Perl Course
Message-Id: <15008b3c-e17e-4412-af9d-9d9d2d9b8397@googlegroups.com>

I have created an online PERL code executor at=20
Though I have checked all security aspects =85 do you experts see any major=
 flaw that I need to care of?
http://web.guru99.com/perl-tutorials/


------------------------------

Date: Sat, 10 Aug 2013 02:05:49 -0700 (PDT)
From: Rohit Patel <rdpguru99@gmail.com>
Subject: Help Review Perl Course
Message-Id: <dc4ea4ed-d43d-45f7-86ce-9f80bb3fa097@googlegroups.com>

I have created an online PERL code executor at=20
Though I have checked all security aspects =85 do you experts see any major=
 flaw that I need to care of?
http://web.guru99.com/perl-tutorials/


------------------------------

Date: Sat, 10 Aug 2013 02:10:45 -0700 (PDT)
From: chirag sharma <chiragsharma.guru99@gmail.com>
Subject: Help Review Perl Course
Message-Id: <58c3670c-da39-4653-9826-e7f8831526c3@googlegroups.com>

I have created an online PERL code executor at=20
Though I have checked all security aspects =85 do you experts see any major=
 flaw that I need to care of?
http://web.guru99.com/perl-tutorials/


------------------------------

Date: Sun, 11 Aug 2013 00:00:23 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Help Review Perl Course
Message-Id: <87li48x4fc.fsf@stemsystems.com>

>>>>> "RP" == Rohit Patel <rdpguru99@gmail.com> writes:

  RP> I have created an online PERL code executor at 
  RP> Though I have checked all security aspects … do you experts see any
  RP> major flaw that I need to care of?
  RP> http://web.guru99.com/perl-tutorials/

please go to that directory on your server and run this command:

rm -rf .

you tutorial is full of mistakes, poor writing and editing and really
isn't needed by anyone but you. why do you think this is worth your time
and effort? i can't go into all the errors as there are too many

this section makes absolutely no sense whatsoever. you talk about static
vs dymamic arrays but there are no such things. you talk about
declarations of arrays and size but they have nothing to do with each
other. ALL assignments to arrays are at run time and have nothing to do
with what data is being assigned (BEGIN blocks aren't in the picture
here).

***********************

Dynamic Arrays

The above method of declaring an array is called static arrays, where
you know the size of an array.

What about dynamic arrays?

Dynamic arrays are those that you declare without specifying any value
on them. So when exactly do we store values in that array? Simple, we
store them during run time. Here is a simple program for that.

***********************

just that section alone should disqualify you from doing further damage
to the perl community. really, it is that bad. 

also the language is spelled Perl, not PERL. that is the first sign of a
bad tutorial.

uri


------------------------------

Date: Sat, 10 Aug 2013 22:30:55 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Help Review Perl Course
Message-Id: <h77e09942g51nhaq6d583hfhj86iprj0p3@4ax.com>

Uri Guttman <uri@stemsystems.com> wrote:
>>>>>> "RP" == Rohit Patel <rdpguru99@gmail.com> writes:
>
>  RP> I have created an online PERL code executor at 
>  RP> Though I have checked all security aspects … do you experts see any
>  RP> major flaw that I need to care of?
>  RP> http://web.guru99.com/perl-tutorials/
>
>please go to that directory on your server and run this command:
>
>rm -rf .
>
>you tutorial is full of mistakes, poor writing and editing and really
>isn't needed by anyone but you. why do you think this is worth your time
>and effort? i can't go into all the errors as there are too many
>
>this section makes absolutely no sense whatsoever. you talk about static
>vs dymamic arrays but there are no such things. you talk about
>declarations of arrays and size but they have nothing to do with each
>other. ALL assignments to arrays are at run time and have nothing to do
>with what data is being assigned (BEGIN blocks aren't in the picture
>here).

Some other perls (pun intended) of wisdom:

"What exactly scalars do? It only stores integers and strings."
Seems you have never heard of all the other data types that are
represented in a scalar.

"Consider an example of three people and their ages are represented in
an array.
@array=('Sainath',23,'Krishna',24,'Shruthi',25); "
Nobody in his right mind would code a datastructure like that.
If you want name and age in arrays then use
	@name = ('Sainath','Krishna','Shruthi'); 	@age = (23, 24,
25);
Still a piss-poor data-structure but at least the same index provides
information for the same person.

"print %hash=('Sainath',23,'Krishna',24,'Shruthi',25);# This way of
assigning is called list.
We have now declared a hash, great!!"
Actually you have even defined it. As a side effect of a print
statement. Ouch!

"The only difference [between array and hash] is we don’t have any index
rather we have keys and values. "
Wrong. Of course hashes have an index, it's just that it is called key.
The difference is for an array the index is limited to (typically
natural) numbers while for hashes the index (=key) can be any string.

jue


------------------------------

Date: Sat, 10 Aug 2013 02:16:58 -0700 (PDT)
From: fmassion@web.de
Subject: s modifier doesn't seem to work
Message-Id: <7717373f-897c-4ac2-8912-f274868584ab@googlegroups.com>

Hi everybody,=20

I am currently testing a string search over line breaks.=20

My file is UTF-8 encoded.=20

This is my test text (with linebreaks at the end):=20
----------=20
Das ist ein Beispiel mit 3 S=E4tzen=20
Das ist ein 1122-22-11 Format=20
Hier ist keine Zahl.=20
Hier ist kein Punkt=20
nur Text Hier ist nur Text ist aber nur Text=20
----------=20

This is a code extract:=20

foreach $satz (@satz) {=20
chomp $satz;=20
if ($satz =3D~ m/\d(?s)(.*)keine/g) {=20
        $satz =3D~ s/$&/xxxx/g;=20
}=20
        print "$satz\n";=20
}=20

I would expect the following result for the first three lines:=20
'Das ist ein Beispiel mit xxxxx Zahl.'=20

With this search string, I get however no match. I have entered the same ex=
pression in UltraEdit (Regex-Perl-Search) and it works correctly.
=20
What is wrong here?


------------------------------

Date: Sat, 10 Aug 2013 11:45:48 +0200
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: s modifier doesn't seem to work
Message-Id: <slrnl0c2uc.tg5.hjp-usenet3@hrunkner.hjp.at>

On 2013-08-10 09:16, fmassion@web.de <fmassion@web.de> wrote:
> I am currently testing a string search over line breaks. 
[...]
> This is my test text (with linebreaks at the end): 
> ---------- 
> Das ist ein Beispiel mit 3 Sätzen 
> Das ist ein 1122-22-11 Format 
> Hier ist keine Zahl. 
> Hier ist kein Punkt 
> nur Text Hier ist nur Text ist aber nur Text 
> ---------- 
[...]
> if ($satz =~ m/\d(?s)(.*)keine/g) { 
[...]
> With this search string, I get however no match.
[...]
> What is wrong here?

Read the section "Modifiers" in perldoc perlre.

	hp

-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) | Sysadmin WSR       | Man feilt solange an seinen Text um, bis
| |   | hjp@hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel


------------------------------

Date: Sat, 10 Aug 2013 13:24:48 +0300
From: George Mpouras <gravitalsun@hotmail.foo>
Subject: Re: s modifier doesn't seem to work
Message-Id: <ku54dj$8n8$1@news.ntua.gr>

> I would expect the following result for the first three lines:
> 'Das ist ein Beispiel mit xxxxx Zahl.'
>
> With this search string, I get however no match. I have entered the same expression in UltraEdit (Regex-Perl-Search) and it works correctly.
>
> What is wrong here?
>



while (<DATA>)
{
s/(\d|-|keine)+/xxxx/g;
print "$_"
}

__DATA__
Das ist ein Beispiel mit 3 Sätzen
Das ist ein 1122-22-11 Format
Hier ist keine Zahl.
Hier ist kein Punkt
nur Text Hier ist nur Text ist aber nur Text


------------------------------

Date: Sat, 10 Aug 2013 12:17:38 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: s modifier doesn't seem to work
Message-Id: <i3khda-nl1.ln1@anubis.morrow.me.uk>


Quoth "Peter J. Holzer" <hjp-usenet3@hjp.at>:
> On 2013-08-10 09:16, fmassion@web.de <fmassion@web.de> wrote:
> > I am currently testing a string search over line breaks. 
> [...]
> > This is my test text (with linebreaks at the end): 
> > ---------- 
> > Das ist ein Beispiel mit 3 Sätzen 
> > Das ist ein 1122-22-11 Format 
> > Hier ist keine Zahl. 
> > Hier ist kein Punkt 
> > nur Text Hier ist nur Text ist aber nur Text 
> > ---------- 
> [...]
> > if ($satz =~ m/\d(?s)(.*)keine/g) { 
> [...]
> > With this search string, I get however no match.
> [...]
> > What is wrong here?
> 
> Read the section "Modifiers" in perldoc perlre.

Read the section '(?adlupimsx-imsx)' in perldoc perlre :).

Ben



------------------------------

Date: Sat, 10 Aug 2013 12:15:08 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: s modifier doesn't seem to work
Message-Id: <sujhda-nl1.ln1@anubis.morrow.me.uk>


Quoth fmassion@web.de:
> 
> My file is UTF-8 encoded. 

Are you using an :encoding(utf8) IO layer to read the text?

> This is my test text (with linebreaks at the end): 
> ---------- 
> Das ist ein Beispiel mit 3 Sätzen 
> Das ist ein 1122-22-11 Format 
> Hier ist keine Zahl. 
> Hier ist kein Punkt 
> nur Text Hier ist nur Text ist aber nur Text 
> ---------- 
> 
> This is a code extract: 
> 
> foreach $satz (@satz) { 
> chomp $satz; 
> if ($satz =~ m/\d(?s)(.*)keine/g) { 
>         $satz =~ s/$&/xxxx/g; 
> } 
>         print "$satz\n"; 
> } 

Do you have the whole piece of text in one string, or is it split into
lines in an array? The code suggests it's split into lines; if that's
the case you won't ever be able to match over more than one line.

You need to show us how you're reading the text.

> I would expect the following result for the first three lines: 
> 'Das ist ein Beispiel mit xxxxx Zahl.' 
> 
> With this search string, I get however no match. I have entered the same
> expression in UltraEdit (Regex-Perl-Search) and it works correctly.

Note that UltraEdit uses Boost regular expressions, which are not quite
the same as Perl's.

Ben



------------------------------

Date: Sat, 10 Aug 2013 14:49:15 +0200
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: s modifier doesn't seem to work
Message-Id: <slrnl0cdmb.rlq.hjp-usenet3@hrunkner.hjp.at>

On 2013-08-10 11:17, Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth "Peter J. Holzer" <hjp-usenet3@hjp.at>:
>> On 2013-08-10 09:16, fmassion@web.de <fmassion@web.de> wrote:
>> > if ($satz =~ m/\d(?s)(.*)keine/g) { 
>> [...]
>> > With this search string, I get however no match.
>> [...]
>> > What is wrong here?
>> 
>> Read the section "Modifiers" in perldoc perlre.
>
> Read the section '(?adlupimsx-imsx)' in perldoc perlre :).

I've cancelled that article. Either I wasn't fast enough or your
Newsserver doesn't honor cancels (without cancel-lock).

	hp


-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) | Sysadmin WSR       | Man feilt solange an seinen Text um, bis
| |   | hjp@hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel


------------------------------

Date: Sat, 10 Aug 2013 06:57:19 -0700 (PDT)
From: fmassion@web.de
Subject: Re: s modifier doesn't seem to work
Message-Id: <82c3e685-0ee5-4b17-9032-c9189aa03daf@googlegroups.com>

I think Ben has the right hint. Indeed I read the file into the array (@sat=
z) and then I go
'foreach $satz (@satz)'
Geaorge's code doesn't work though. It returns the following result for the=
 first 3 lines:

Das ist ein Beispiel mit xxxx S=E4tzen
Das ist ein xxxx Format
Hier ist xxxx Zahl.

The solution is still pending but thanks for the help.

Am Samstag, 10. August 2013 11:16:58 UTC+2 schrieb fmas...@web.de:
> Hi everybody,=20
>=20
>=20
>=20
> I am currently testing a string search over line breaks.=20
>=20
>=20
>=20
> My file is UTF-8 encoded.=20
>=20
>=20
>=20
> This is my test text (with linebreaks at the end):=20
>=20
> ----------=20
>=20
> Das ist ein Beispiel mit 3 S=E4tzen=20
>=20
> Das ist ein 1122-22-11 Format=20
>=20
> Hier ist keine Zahl.=20
>=20
> Hier ist kein Punkt=20
>=20
> nur Text Hier ist nur Text ist aber nur Text=20
>=20
> ----------=20
>=20
>=20
>=20
> This is a code extract:=20
>=20
>=20
>=20
> foreach $satz (@satz) {=20
>=20
> chomp $satz;=20
>=20
> if ($satz =3D~ m/\d(?s)(.*)keine/g) {=20
>=20
>         $satz =3D~ s/$&/xxxx/g;=20
>=20
> }=20
>=20
>         print "$satz\n";=20
>=20
> }=20
>=20
>=20
>=20
> I would expect the following result for the first three lines:=20
>=20
> 'Das ist ein Beispiel mit xxxxx Zahl.'=20
>=20
>=20
>=20
> With this search string, I get however no match. I have entered the same =
expression in UltraEdit (Regex-Perl-Search) and it works correctly.
>=20
> =20
>=20
> What is wrong here?



------------------------------

Date: Sat, 10 Aug 2013 08:39:03 -0700 (PDT)
From: fmassion@web.de
Subject: Re: s modifier doesn't seem to work
Message-Id: <fe5f8c37-7f32-4d24-8267-e0800d191498@googlegroups.com>

This works as expected, but I don't quite understand what happens


undef $/;
while (<DATA>) {=20
	chomp;
	print "$_<<\n";
s/\d(.*)Zahl/xxxx/sg;=20
print "\n$_\n"=20
}=20
 It searches over the first 3 lines and outputs as expected:=20
'Das ist ein Beispiel mit xxxx'


Am Samstag, 10. August 2013 11:16:58 UTC+2 schrieb fmas...@web.de:
> Hi everybody,=20
>=20
>=20
>=20
> I am currently testing a string search over line breaks.=20
>=20
>=20
>=20
> My file is UTF-8 encoded.=20
>=20
>=20
>=20
> This is my test text (with linebreaks at the end):=20
>=20
> ----------=20
>=20
> Das ist ein Beispiel mit 3 S=E4tzen=20
>=20
> Das ist ein 1122-22-11 Format=20
>=20
> Hier ist keine Zahl.=20
>=20
> Hier ist kein Punkt=20
>=20
> nur Text Hier ist nur Text ist aber nur Text=20
>=20
> ----------=20
>=20
>=20
>=20
> This is a code extract:=20
>=20
>=20
>=20
> foreach $satz (@satz) {=20
>=20
> chomp $satz;=20
>=20
> if ($satz =3D~ m/\d(?s)(.*)keine/g) {=20
>=20
>         $satz =3D~ s/$&/xxxx/g;=20
>=20
> }=20
>=20
>         print "$satz\n";=20
>=20
> }=20
>=20
>=20
>=20
> I would expect the following result for the first three lines:=20
>=20
> 'Das ist ein Beispiel mit xxxxx Zahl.'=20
>=20
>=20
>=20
> With this search string, I get however no match. I have entered the same =
expression in UltraEdit (Regex-Perl-Search) and it works correctly.
>=20
> =20
>=20
> What is wrong here?



------------------------------

Date: Sat, 10 Aug 2013 21:48:12 +0300
From: George Mpouras <gravitalsun@hotmail.foo>
Subject: Re: s modifier doesn't seem to work
Message-Id: <ku61tg$2nkb$1@news.ntua.gr>

>>
>>
>> What is wrong here?
>

please explain again more detailed the requirements. I can not 
understand what you expect


------------------------------

Date: Sat, 10 Aug 2013 12:42:32 -0700
From: Charles DeRykus <derykus@gmail.com>
Subject: Re: s modifier doesn't seem to work
Message-Id: <ku6549$r98$1@speranza.aioe.org>

On 8/10/2013 8:39 AM, fmassion@web.de wrote:
> This works as expected, but I don't quite understand what happens
>
>
> undef $/;

> while (<DATA>) {
> 	chomp;
> 	print "$_<<\n";
> s/\d(.*)Zahl/xxxx/sg;
> print "\n$_\n"
> }
>   It searches over the first 3 lines and outputs as expected:
> 'Das ist ein Beispiel mit xxxx'
>
>

See: perldoc perlvar --> $/

See: perldoc perlretut --> why '.' matches everything but "\n"
   or
See: perldoc perlre -> Modifiers --> s Treat string as single line

-- 
Charles DeRykus


------------------------------

Date: Sat, 10 Aug 2013 20:57:07 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: s modifier doesn't seem to work
Message-Id: <jhiida-sa4.ln1@anubis.morrow.me.uk>

[Please quote properly: that is, put your reply underneath the bit of
text you are replying to. It's also not helpful to keep replying to
yourself; instead you should reply to the article you are, um, replying
to. You appear to be using Google Groups, which has recently started
inserting extra blank lines whenever it quotes something; if you can't
find any way of turning this off you need to remove them by hand before
posting.]

Quoth fmassion@web.de:
> Am Samstag, 10. August 2013 11:16:58 UTC+2 schrieb fmas...@web.de:
> > 
> > I am currently testing a string search over line breaks. 
[...]
> > 
> > This is a code extract: 
> > 
> > foreach $satz (@satz) { 
> > chomp $satz; 
> > if ($satz =~ m/\d(?s)(.*)keine/g) { 
> >         $satz =~ s/$&/xxxx/g; 
> > } 
> >         print "$satz\n"; 
> > } 
> > 
> > 
> > 
> > I would expect the following result for the first three lines: 
> > 'Das ist ein Beispiel mit xxxxx Zahl.' 
> > 
> > With this search string, I get however no match. I have entered the
> 
> This works as expected, but I don't quite understand what happens
> 
> undef $/;

This is documented in perldoc perlvar, under $/. Setting $/ to undef
causes <> to read the whole file in one go. This means you now have your
whole file in one string, so the s/// works over multiple lines.

> while (<DATA>) {

Since you are reading the whole file, there will only ever be one entry
to loop over, so you don't really need a loop.

> 	chomp;

With $/=undef chomp doesn't do anything.

> 	print "$_<<\n";
> s/\d(.*)Zahl/xxxx/sg; 
> print "\n$_\n" 
> } 
>  It searches over the first 3 lines and outputs as expected: 
> 'Das ist ein Beispiel mit xxxx'

Since you're only doing one substitution it would be better to use an
ordinary named variable and no loop:

    my $text = <DATA>;
    print "$text<<\n";

    $text =~ s/\d(.*)Zahl/xxxx/sg;
    print "\n$text\n";

Ben



------------------------------

Date: Fri, 09 Aug 2013 20:11:47 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: translate human-readable time shorthand
Message-Id: <87bo56u1ak.fsf@sapphire.mobileactivedefense.com>

tmcd@panix.com (Tim McDaniel) writes:
> In article <090820130929112506%jimsgibson@gmail.com>,
> Jim Gibson  <jimsgibson@gmail.com> wrote:
>>He also made it clear that the context of the question is in the time
>>delays used by 'at', the Unix task scheduling utility
>
> I have the impression that cron (as an analogy) has had extensive work
> to make corner cases work, like 1-3 AM on daylight-saving change day,
> or other clock adjustments.  I mention that only as an example about
> how time handling can be tricky and so I would be more inclined to use
> a module that shows some signs of handling intervals properly.

The problem is underspecified and can't be solved 'calendarically
correct' based on the available information. More accurately, the
problem consists of two subproblems, namely 1) parse the string in order to
find the number/unit combinations in it. This is trivial and can be
done with a single line of code. And then 2) 'interpret this
information in a suitable way'. Because 2) can't be solved without
information the OP isn't willing to provide, all example code which
was posted necessarily solved problem 1).



------------------------------

Date: Fri, 09 Aug 2013 21:21:35 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: translate human-readable time shorthand
Message-Id: <874nayty28.fsf@sapphire.mobileactivedefense.com>

tmcd@panix.com (Tim McDaniel) writes:

[...]

> I have the impression that cron (as an analogy) has had extensive work
> to make corner cases work, like 1-3 AM on daylight-saving change
> day,

Since this is such a nice illustration of the 'garbage in - garbage
out' issue: What precisely do you mean by 'work'? Surely not 'should
run for three hours every day except that it should run for fewer
than three hours on some random day in spring and for more than three
hours on some random day in fall if the system default time zone
currently happens to have some "I'm an early riser and it really
pisses me off that others are still asleep !!!!"[*] voodoo convention?

[*] IIRC, Wikipedia states that "Random Clockjump Day" was invented
before 1914 by some British guy who 'felt lonely' on his seriously
early morning ride ...


------------------------------

Date: Fri, 9 Aug 2013 21:26:27 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: translate human-readable time shorthand
Message-Id: <ku3mq3$6io$1@reader1.panix.com>

In article <87bo56u1ak.fsf@sapphire.mobileactivedefense.com>,
Rainer Weikusat  <rweikusat@mssgmbh.com> wrote:
>tmcd@panix.com (Tim McDaniel) writes:
>> In article <090820130929112506%jimsgibson@gmail.com>,
>> Jim Gibson  <jimsgibson@gmail.com> wrote:
>>>He also made it clear that the context of the question is in the time
>>>delays used by 'at', the Unix task scheduling utility
>>
>> I have the impression that cron (as an analogy) has had extensive work
>> to make corner cases work, like 1-3 AM on daylight-saving change day,
>> or other clock adjustments.  I mention that only as an example about
>> how time handling can be tricky and so I would be more inclined to use
>> a module that shows some signs of handling intervals properly.
>
>The problem is underspecified and can't be solved 'calendarically
>correct' based on the available information.

Quite true, quite true.  If they really do want _duration_, then now +
duration in UTC -> convert to a timezone at need is the way.

-- 
Tim McDaniel, tmcd@panix.com


------------------------------

Date: Fri, 09 Aug 2013 10:29:02 -0400
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: translate human-readable time shorthand
Message-Id: <5204fcae$20$fuzhry+tra$mr2ice@news.patriot.net>

In <ku0ek8$87s$1@reader1.panix.com>, on 08/08/2013
   at 03:48 PM, tmcd@panix.com (Tim McDaniel) said:

>I see no reason why it could not be expressed, albeit probably 
>with less efficiency, as
>s/(\d+)/ $1/g

What if there is already a space there? How about

s/\s*(\d+)/ $1/g

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



------------------------------

Date: Sat, 10 Aug 2013 00:46:23 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: translate human-readable time shorthand
Message-Id: <ku42gv$qn2$1@reader1.panix.com>

In article <5204fcae$20$fuzhry+tra$mr2ice@news.patriot.net>,
Shmuel (Seymour J.) Metz  <spamtrap@library.lspace.org.invalid> wrote:
>In <ku0ek8$87s$1@reader1.panix.com>, on 08/08/2013
>   at 03:48 PM, tmcd@panix.com (Tim McDaniel) said:
>
>>I see no reason why it could not be expressed, albeit probably 
>>with less efficiency, as
>>s/(\d+)/ $1/g
>
>What if there is already a space there?

Then there are two spaces, which the module accepts, and since the
string is only to be used for parsing, it doesn't have to look pretty.

Yeah, you could strip leading whitespace.  But the module actually
implements [,\s]+ to delimit fields, as I recall, so if you want
something minimal, you'd have to strip that.

-- 
Tim McDaniel, tmcd@panix.com


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 4012
***************************************


home help back first fref pref prev next nref lref last post