[30484] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1727 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 17 09:09:50 2008

Date: Thu, 17 Jul 2008 06:09:14 -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           Thu, 17 Jul 2008     Volume: 11 Number: 1727

Today's topics:
    Re: C linked lists in Perl <Peter@PSDT.com>
    Re: C linked lists in Perl <cartercc@gmail.com>
    Re: C linked lists in Perl <cwilbur@chromatico.net>
    Re: C linked lists in Perl <cwilbur@chromatico.net>
    Re: C linked lists in Perl <cartercc@gmail.com>
    Re: comma quoted lists question <cartercc@gmail.com>
    Re: FAQ 1.12 What's the difference between "perl" and " <cwilbur@chromatico.net>
        Question in Perl Arrays <yogeshkagrawal@gmail.com>
    Re: Question in Perl Arrays <noreply@gunnar.cc>
    Re: Question in Perl Arrays <yogeshkagrawal@gmail.com>
    Re: Question in Perl Arrays <RedGrittyBrick@SpamWeary.foo>
    Re: Question in Perl Arrays <wahab@chemie.uni-halle.de>
    Re: Question in Perl Arrays <yogeshkagrawal@gmail.com>
    Re: Question in Perl Arrays <fawaka@gmail.com>
    Re: Question in Perl Arrays <yogeshkagrawal@gmail.com>
    Re: Question in Perl Arrays <RedGrittyBrick@SpamWeary.foo>
    Re: Question in Perl Arrays <wahab@chemie.uni-halle.de>
    Re: Question in Perl Arrays <RedGrittyBrick@SpamWeary.foo>
    Re: Regular Expression Problem <daveb@addr.invalid>
    Re: reliability problem with Finance::QuoteHist::Yahoo <Peter@PSDT.com>
    Re: Which domain registrar best for perl scripting? <soup_or_power@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 17 Jul 2008 10:56:34 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: C linked lists in Perl
Message-Id: <pan.2008.07.17.10.56.33.961946@PSDT.com>

On Wed, 16 Jul 2008 13:11:24 -0700, cartercc wrote:
> I guess like almost everybody, I like to discuss (argue) the merits of
> different technologies. In my world, the big two are Java and
> ColdFusion. Recently, we had someone with a background in embedded
> systems who has been advocating C. The conversation goes something
> like this:
> 
> him - Does Perl have linked lists?
> me - No.
> him - Therefore, C is better than Perl because it has linked lists.
> me - But Perl has other data structures that are easier to use than
> linked lists.
> him - So what? Perl still doesn't have linked lists.

That is the most asinine reasoning I have seen quoted on this group for at
least the last five minutes.  Not only is it just as easy if not more so
to create linked lists in Perl as in C, but most of the reasons for
wanting to do so are rendered moot by Perl because of things that its
arrays can do that C's can't.

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



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

Date: Thu, 17 Jul 2008 05:19:14 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: C linked lists in Perl
Message-Id: <91f34b0a-197a-41fe-b579-7f02069f3421@y21g2000hsf.googlegroups.com>

On Jul 16, 6:58 pm, Joost Diepenmaat <jo...@zeekat.nl>
> Get a copy of "practical common lisp", or browse the book for free
> online athttp://gigamonkeys.com/book/

I have PCL (Seibel), ACL (Graham), SL (Lamkins), Little Lisper, and
have a longstanding objective of learning and using Lisp, which
unfortunantly appears to be receding into the distant future.
Currently, I have fallen into lust with Erlang, which I have used to
complete a couple of small projects. I think that Erlang has a future,
while Lisp may only have a past.

> It's not about perl, but it *will* show you some interesting uses of
> linked lists and teach you the basics of lisp, so good things can be
> expected.

For about ten years I have attempted to 'learn' one new language a
year. These have included XSLT and Scheme and Python. I am now
'learning' C as a reaction to my continuing conversations. IMO, you
can't be good in more than two or three at a time, and my present list
includes Perl, Java, Erlang, with PowerShell a distant fourth.

CC


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

Date: Thu, 17 Jul 2008 08:44:31 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: C linked lists in Perl
Message-Id: <86tzeod6j4.fsf@mithril.chromatico.net>

>>>>> "cc" == cartercc  <cartercc@gmail.com> writes:

    cc> For about ten years I have attempted to 'learn' one new language
    cc> a year. These have included XSLT and Scheme and Python. I am now
    cc> 'learning' C as a reaction to my continuing conversations. 

If what you say in your initial post is true -- that you have never
coded a linked list, or seriously thought about doing so -- then you're
wasting a lot of time playing with the superficial syntax of various
languages.  You need to sit down and study data structures and
algorithms, independent of any language.  This will get you a lot
farther than learning whether yet another language uses := or = to set a
variable's value.

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Thu, 17 Jul 2008 08:41:49 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: C linked lists in Perl
Message-Id: <86y740d6nm.fsf@mithril.chromatico.net>

>>>>> "cc" == cartercc  <cartercc@gmail.com> writes:

    cc> him - Does Perl have linked lists?  me - No.  

This is where you went wrong.  The answer is not "no," but "perldoc -q
linked".  Indeed, you'll see that Perl *does* have linked lists, but
that the built-in list type makes them pretty much useless.

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Thu, 17 Jul 2008 06:00:57 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: C linked lists in Perl
Message-Id: <af543632-f1d7-4a08-8d10-d3c6f3409d5d@l64g2000hse.googlegroups.com>

On Jul 17, 8:44 am, Charlton Wilbur <cwil...@chromatico.net> wrote:
> If what you say in your initial post is true -- that you have never
> coded a linked list, or seriously thought about doing so -- then you're
> wasting a lot of time playing with the superficial syntax of various
> languages.  You need to sit down and study data structures and
> algorithms, independent of any language.  This will get you a lot
> farther than learning whether yet another language uses := or = to set a
> variable's value.

Not that it makes any difference, but my undergraduate background was
English, I got a law degree and practiced law for 17 years before
changing professions, I have two MS (CS and SWE) but have never had an
undergraduate CS course, so I never had discrete math, algorithms,
data structures, etc. I agree fully with your recommendation. I have
done well in graduate courses because the instructors presuppose that
the students have the foundations so they focus on higher level
things, but I'll tell you from extensive personal experience that not
having the basics is a real handicap.

OTOH, I have found that technical people have a really narrow focus
and a very narrow range of knowledge, and I believe that on the whole
we are better served by a breadth of knowledge that allows us to make
connections. I find that I am able to make contributions to the
discussions that others cannot make because of my background.

CC


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

Date: Thu, 17 Jul 2008 05:27:38 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: comma quoted lists question
Message-Id: <40b88c32-2e44-4813-a508-7de2112195e6@59g2000hsb.googlegroups.com>

On Jul 16, 6:26 pm, "Dan Mercer" <damer...@comcast.net> wrote:
> If you want eXcel files,  why don't you create them instead of CSV's.

Because it is easy to open a file with a .csv extension and print my
row strings to the file - no special modules or magic required.

> There is plenty of support for excel in perl.  I produce disk usage
> reports using Spreadsheet::WriteExcel and it could not be easier.  I even
> add a SUM column.

Yes, I am learning. I intend to add this weapon to my arsenal in the
next week or so. I have recently done the same for PDF and have
discovered anew the truth of Clark's law that 'Any sufficiently
advanced technology is indistinguishable from magic.'

CC


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

Date: Thu, 17 Jul 2008 08:39:36 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: FAQ 1.12 What's the difference between "perl" and "Perl"?
Message-Id: <863am8elbr.fsf@mithril.chromatico.net>

>>>>> "GCE" == Gordon Corbin Etly <jdhog@gmail.com> writes:

    GCE> Charlton Wilbur wrote:

    >> I'm telling you that using it makes you look like someone who's
    >> inexperienced with Perl,

    GCE> But, *why*? What *real* connection is there between writing
    GCE> "PERL" and being inexperienced? 

People who are inexperienced do it with great frequency.  Pay attention
and see.  It's a clear correlation to just about anyone who's ever had
to hire a Perl programmer.

    >> like someone who's never read the FAQ, or

    GCE> Why is it, again and again, you people seem to mistake the
    GCE> purpose of an FAQ; they exist to be guidelines. They were never
    GCE> intended to be regarded as a biblical document.

Except when they prove the point you want to make -- you've cited the
FAQ several times in support of your idée fixe.

A programmer who's never read the FAQ is unlikely to be a very good
one.  A programmer who's read the FAQ and is *sure* he knows better is
also unlikely to be a very good one.  And a programmer who reads the
FAQ, encounters the advice on never writing PERL, and makes up a
spurious justification for doing so -- he's likely to be a stubbornly
untraininable halfwit, at least on the evidence so far provided.

    >> who's too stubborn to conform to common usage.

    GCE> IMHO, it takes a strong mind to realize you don't have to
    GCE> conform to every single thing a pseudo society says is right or
    GCE> wrong. Those who do a little more than sheep.

And it takes an intelligent mind to figure out where it's important to
take a stand and where it's a pointless waste of effort.  Being stubborn
about foolish things is no benefit.

    >> These are the three reasons that people commonly use PERL.
    >> Inexperience, ignorance, intransigence.

    GCE> This is nothing short of a stereotype.

Find me an instance of someone using PERL that can't be ascribed to one
of the the three.  For the record, your usage is solidly in the third
category.

Charlton




-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Thu, 17 Jul 2008 00:52:08 -0700 (PDT)
From: Yogi <yogeshkagrawal@gmail.com>
Subject: Question in Perl Arrays
Message-Id: <606ecbc2-ef61-413e-9a18-5a98b82a763b@c65g2000hsa.googlegroups.com>

Hi,

I am trying to understand how arrays work in scalar context. Here is
the question:

@a = (10,20,30,40,50);
@b = @a[0..3];
print "[@b] \n";

when I run this script, I am getting proper result i.e. o/p is: [10 20
30 40]
But when I do this change:
@a = (10,20,30,40,50);
@b = $a[0..3];  # THIS LINE IS CHANGED
print "[@b] \n";

I get o/p as: [20]. why? why first element of the range operator is
ignored and 2nd element is assigned to @b. I am trying this just to
satisfy my curiosity.

Regards,



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

Date: Thu, 17 Jul 2008 11:04:50 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Question in Perl Arrays
Message-Id: <6e8ga0F5i6f8U1@mid.individual.net>

Yogi wrote:
> I am trying to understand how arrays work in scalar context.

Your example below has nothing to do with scalar context.

Missing:

     use strict;
     use warnings;

> @a = (10,20,30,40,50);
> @b = @a[0..3];
> print "[@b] \n";
> 
> when I run this script, I am getting proper result i.e. o/p is: [10 20
> 30 40]
> But when I do this change:
> @a = (10,20,30,40,50);
> @b = $a[0..3];  # THIS LINE IS CHANGED
> print "[@b] \n";
> 
> I get o/p as: [20]. why?

Probably because $a[0..3] is plain wrong. An array slice never starts 
with '$'.

If warnings had been enabled, Perl would have objected.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Thu, 17 Jul 2008 02:15:43 -0700 (PDT)
From: Yogi <yogeshkagrawal@gmail.com>
Subject: Re: Question in Perl Arrays
Message-Id: <e5823172-3668-4dd7-824c-48174134ca56@e53g2000hsa.googlegroups.com>

On Jul 17, 2:04=A0pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> Yogi wrote:
> > I am trying to understand how arrays work in scalar context.
>
> Your example below has nothing to do with scalar context.
>
> Missing:
>
> =A0 =A0 =A0use strict;
> =A0 =A0 =A0use warnings;
>
> > @a =3D (10,20,30,40,50);
> > @b =3D @a[0..3];
> > print "[@b] \n";
>
> > when I run this script, I am getting proper result i.e. o/p is: [10 20
> > 30 40]
> > But when I do this change:
> > @a =3D (10,20,30,40,50);
> > @b =3D $a[0..3]; =A0# THIS LINE IS CHANGED
> > print "[@b] \n";
>
> > I get o/p as: [20]. why?
>
> Probably because $a[0..3] is plain wrong. An array slice never starts
> with '$'.
>
> If warnings had been enabled, Perl would have objected.
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl

Hi,
This is giving me same output (with warning ofcourse):
use strict;
use warnings;
my @b=3D();

my @a =3D (10,20,30,40,50);
@b =3D $a[0..3];
print "[@b] \n";

If Array slice must not start with '$', it should not give me 20 as o/
p.
Please suggest.
-Regards


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

Date: Thu, 17 Jul 2008 10:42:20 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Question in Perl Arrays
Message-Id: <487f13fb$0$2920$fa0fcedb@news.zen.co.uk>

Yogi wrote:
> On Jul 17, 2:04 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
>> Yogi wrote:
>>> I am trying to understand how arrays work in scalar context.
>> Your example below has nothing to do with scalar context.
>>
>> Missing:
>>
>>      use strict;
>>      use warnings;
>>
>>> @a = (10,20,30,40,50);
>>> @b = @a[0..3];
>>> print "[@b] \n";
>>> when I run this script, I am getting proper result i.e. o/p is: [10 20
>>> 30 40]
>>> But when I do this change:
>>> @a = (10,20,30,40,50);
>>> @b = $a[0..3];  # THIS LINE IS CHANGED
>>> print "[@b] \n";
>>> I get o/p as: [20]. why?
>> Probably because $a[0..3] is plain wrong. An array slice never starts
>> with '$'.
>>
>> If warnings had been enabled, Perl would have objected.
>>
>> --
>> Gunnar Hjalmarsson
>> Email:http://www.gunnar.cc/cgi-bin/contact.pl
> 
> Hi,
> This is giving me same output (with warning ofcourse):
> use strict;
> use warnings;
> my @b=();
> 
> my @a = (10,20,30,40,50);
> @b = $a[0..3];
> print "[@b] \n";
> 
> If Array slice must not start with '$', it should not give me 20 as o/
> p.

Yes it should.

C:\>perl -e "print 0..3"
0123
C:\>perl -e "print scalar (0..3)"
1

So 0..3 evaluates to 1 in a scalar context.
Therefore $a[0..3] is $a[1]
Presumably because array indexing uses a scalar index.


-- 
RGB


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

Date: Thu, 17 Jul 2008 11:46:03 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: Question in Perl Arrays
Message-Id: <g5n4cq$2v6g$1@nserver.hrz.tu-freiberg.de>

RedGrittyBrick wrote:
>> my @a = (10,20,30,40,50);
>> @b = $a[0..3];
>> print "[@b] \n";
>>
>> If Array slice must not start with '$', it should not give me 20 as o/
>> p.
> 
> Yes it should.
> 
> C:\>perl -e "print 0..3"
> 0123
> C:\>perl -e "print scalar (0..3)"
> 1
> 
> So 0..3 evaluates to 1 in a scalar context.
> Therefore $a[0..3] is $a[1]
> Presumably because array indexing uses a scalar index.

Wrong. This is the flip-flop operator.
In scalar context with two constants,
it's matched against $.

   ...
   $.= 2;
   print "$.\n";
   print $a[0..3], "\n"; # will return $. if first operand (0) is false
   ...


Regards

M.


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

Date: Thu, 17 Jul 2008 04:25:04 -0700 (PDT)
From: Yogi <yogeshkagrawal@gmail.com>
Subject: Re: Question in Perl Arrays
Message-Id: <fc49f1cf-8c8a-457f-93ff-496da22dff82@p25g2000hsf.googlegroups.com>

On Jul 17, 2:46=A0pm, Mirco Wahab <wa...@chemie.uni-halle.de> wrote:
> RedGrittyBrick wrote:
> >> my @a =3D (10,20,30,40,50);
> >> @b =3D $a[0..3];
> >> print "[@b] \n";
>
> >> If Array slice must not start with '$', it should not give me 20 as o/
> >> p.
>
> > Yes it should.
>
> > C:\>perl -e "print 0..3"
> > 0123
> > C:\>perl -e "print scalar (0..3)"
> > 1
>
> > So 0..3 evaluates to 1 in a scalar context.
> > Therefore $a[0..3] is $a[1]
> > Presumably because array indexing uses a scalar index.
>
> Wrong. This is the flip-flop operator.
> In scalar context with two constants,
> it's matched against $.
>
> =A0 =A0...
> =A0 =A0$.=3D 2;
> =A0 =A0print "$.\n";
> =A0 =A0print $a[0..3], "\n"; # will return $. if first operand (0) is fal=
se
> =A0 =A0...
>
> Regards
>
> M.

Is there any simple document which explains how its working?  I tried
reading thru perldoc for .. operator, but am really confused between
list and scalar contexts?

Regards,


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

Date: Thu, 17 Jul 2008 13:49:34 +0200
From: Leon Timmermans <fawaka@gmail.com>
Subject: Re: Question in Perl Arrays
Message-Id: <537fe$487f31ce$89e0e08f$22247@news1.tudelft.nl>

On Thu, 17 Jul 2008 04:25:04 -0700, Yogi wrote:

> On Jul 17, 2:46 pm, Mirco Wahab <wa...@chemie.uni-halle.de> wrote:
>>
>> Wrong. This is the flip-flop operator. In scalar context with two
>> constants, it's matched against $.
>>
>>    ...
>>    $.= 2;
>>    print "$.\n";
>>    print $a[0..3], "\n"; # will return $. if first operand (0) is
>>    false ...
>>
>> Regards
>>
>> M.
> 
> Is there any simple document which explains how its working?  I tried
> reading thru perldoc for .. operator, but am really confused between
> list and scalar contexts?
> 
> Regards,

The .. operator can be quite confusing when it comes to context. You 
should read the perlop on "Range operators" for a detailed information 
about it. As for contexts: @a[] evaluates its index under list context, $a
[] does so under scalar context. In both cases, that makes a lot of sense 
when you realize what they do.

Leon Timmermans


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

Date: Thu, 17 Jul 2008 05:11:02 -0700 (PDT)
From: Yogi <yogeshkagrawal@gmail.com>
Subject: Re: Question in Perl Arrays
Message-Id: <2a87c779-b2fb-481f-b19f-69c4d2d5d84e@l42g2000hsc.googlegroups.com>

On Jul 17, 4:49=A0pm, Leon Timmermans <faw...@gmail.com> wrote:
> On Thu, 17 Jul 2008 04:25:04 -0700, Yogi wrote:
> > On Jul 17, 2:46=A0pm, Mirco Wahab <wa...@chemie.uni-halle.de> wrote:
>
> >> Wrong. This is the flip-flop operator. In scalar context with two
> >> constants, it's matched against $.
>
> >> =A0 =A0...
> >> =A0 =A0$.=3D 2;
> >> =A0 =A0print "$.\n";
> >> =A0 =A0print $a[0..3], "\n"; # will return $. if first operand (0) is
> >> =A0 =A0false ...
>
> >> Regards
>
> >> M.
>
> > Is there any simple document which explains how its working? =A0I tried
> > reading thru perldoc for .. operator, but am really confused between
> > list and scalar contexts?
>
> > Regards,
>
> The .. operator can be quite confusing when it comes to context. You
> should read the perlop on "Range operators" for a detailed information
> about it. As for contexts: @a[] evaluates its index under list context, $=
a
> [] does so under scalar context. In both cases, that makes a lot of sense
> when you realize what they do.
>
> Leon Timmermans

Thanks all.  I started picking up bit of this context usage. :)
-Regards


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

Date: Thu, 17 Jul 2008 13:39:57 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Question in Perl Arrays
Message-Id: <487f3d9d$0$26083$db0fefd9@news.zen.co.uk>

Mirco Wahab wrote:
> RedGrittyBrick wrote:
>>> my @a = (10,20,30,40,50);
>>> @b = $a[0..3];
>>> print "[@b] \n";
>>>
>>> If Array slice must not start with '$', it should not give me 20 as o/
>>> p.
>>
>> Yes it should.
>>
>> C:\>perl -e "print 0..3"
>> 0123
>> C:\>perl -e "print scalar (0..3)"
>> 1
>>
>> So 0..3 evaluates to 1 in a scalar context.
>> Therefore $a[0..3] is $a[1]
>> Presumably because array indexing uses a scalar index.
> 
> Wrong. This is the flip-flop operator.
> In scalar context with two constants,
> it's matched against $.
> 
>   ...
>   $.= 2;
>   print "$.\n";
>   print $a[0..3], "\n"; # will return $. if first operand (0) is false
>   ...
> 
> 

TFTC

-- 
RGB


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

Date: Thu, 17 Jul 2008 14:42:46 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: Question in Perl Arrays
Message-Id: <g5neo6$qj$1@nserver.hrz.tu-freiberg.de>

RedGrittyBrick wrote:
> Mirco Wahab wrote:
>> RedGrittyBrick wrote:
>>> So 0..3 evaluates to 1 in a scalar context.
>>> Therefore $a[0..3] is $a[1]
>>> Presumably because array indexing uses a scalar index.
> 
> TFTC

Oops, what's the meaning of that?


Consider:

 ...

my @arr = 0..999;    # some data
$. = $[;             # $. to first array index

for (@arr) {
    print "$_\n" if 100..120;
    ++$.
}

 ...

Regards

M.


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

Date: Thu, 17 Jul 2008 14:08:15 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Question in Perl Arrays
Message-Id: <487f4440$0$2911$fa0fcedb@news.zen.co.uk>

Mirco Wahab wrote:
> RedGrittyBrick wrote:
>>
>> TFTC
> 
> Oops, what's the meaning of that?

It is an abbreviation of "Thanks For The Correction".

Sometimes I accidentally use abbreviations which are common in another 
forum but rare in this one.

SFCC

-- 
RGB


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

Date: Thu, 17 Jul 2008 09:44:28 +0200
From: Dave B <daveb@addr.invalid>
Subject: Re: Regular Expression Problem
Message-Id: <g5mt23$3p0$1@registered.motzarella.org>

Kryten wrote:

> Eg. If  I have (forgive the $ prefix, but it's the only way I know to
> express it!)
> 
> $a = "tty01 17 07 08 15:45 sch0999 some more text here"
> 
> I want to find a way to carve off "tty01 17 07 08 15:45" into one
> variable.
> "sch0999" into another variable (this is the important one) and lastly
> "some more text here" into the last variable.
> 
> So that I can then go back and process the "sch0999" string later.
> 
> Now, I will never know what sch0999 wil look like exactly but I can
> describe what it will look like as the regex : "\w{3}\d{4}"
> and while I will never know what is going to precede it exactly, I do
> know that it will be the time plus whitespace : "\d{2}:\d{2}.+".
> 
> I don't know much about regex at all! But I had *heard* of positive
> lookbehind and it sounded about right for what I'll need to do, that
> is do a positive lookbehind for the first regex on the basis the
> second can  be matched as well.

Ok. In your first post you mentioned lookbehind, so I gave you an example.
But as others have already said, you may be able to do what you want to
without using lookaround, which is certainly more efficient.
Also, if it turns out that you absolutely need lookbehind (seems unlikely),
keep in mind that Perl (AFAIK) does not support variable-length lookbehind,
so you can't say for instance

/(?<=\d+)bananas/

but again, you probably don't need lookbehind at all in your case.

-- 
D.


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

Date: Thu, 17 Jul 2008 10:42:29 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: reliability problem with Finance::QuoteHist::Yahoo
Message-Id: <pan.2008.07.17.10.42.26.929225@PSDT.com>

On Wed, 16 Jul 2008 12:39:32 -0700, Ted Byers wrote:
> On Jul 16, 7:45 am, Ted Byers <r.ted.by...@gmail.com> wrote:
>> > > Can't use an undefined value as an ARRAY reference at C:/Perl/site/lib/
>> > > Finance/QuoteHist/Generic.pm line 863.
>>
>> > Line 863 of the current version of that module does not attempt an array
>> > dereference.  Consider upgrading.
>>
> I am using version 1.11.  I know that is about a year old, but I
> haven't found a more recent release.  Is there one?

Then the line number is being misreported (very unusual for a run-time
error):

   859  sub target_mode {
   860    my $self = shift;
   861    if (@_) {
   862      $self->{target_mode} = shift;
   863    }
   864    $self->{target_mode} || $self->default_target_mode;
   865  }
   866

Check your file.

> Can't use an undefined value as an ARRAY reference at C:/Perl/site/lib/
> Finance/QuoteHist/Generic.pm line 863.
>  at k:/MarketData/TickerSymbolsTest2.pl line 8
> 	main::__ANON__('Can\'t use an undefined value as an ARRAY reference
> at C:/Per...') called at C:/Perl/site/lib/Finance/QuoteHist/Generic.pm
> line 863
> 	
> Finance::QuoteHist::Generic::lineup('Finance::QuoteHist::Yahoo=HASH(0x1a309a8)')
> called at C:/Perl/site/lib/Finance/QuoteHist/Generic.pm line 422

In my copy of this file, ->lineup() is called at line 437.  However, in
version 1.10 (from backpan), not only is lineup() called from line 422,
but:

   860  sub lineup {
   861    my $self = shift;
   862    $self->{lineup} = \@_ if @_;
   863    @{$self->{lineup}};
   864  }

And there's the array deref right where perl said.  Therefore I am sure
you have an outdated version, whatever you think its number is.  Upgrade
and rerun.

> 	Finance::QuoteHist::Generic::__ANON__() called at C:/Perl/site/lib/
> Finance/QuoteHist/Generic.pm line 142
> 	
> Finance::QuoteHist::Generic::dividends('Finance::QuoteHist::Yahoo=HASH(0x1a309a8)')
> called at k:/MarketData/TickerSymbolsTest2.pl line 62
> 
> Compilation exited abnormally with code 2 at Wed Jul 16 15:29:31
> 
> 
> Does this make more sense?
> 
> The ticker it dies on is ACLO.OB.
> 
> NB: Computing yesterday's date from today's postponed the crash until
> dividends() is called.  Is there a way to query yahoo to find out the
> inception date of a given ticker? 

http://finance.yahoo.com/q/hp?s=ACLO.OB fills in the inception date as the
start date.  I've not dealt with enough different symbols that I needed
to automate fetching it.  I don't know if that's your problem though.

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



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

Date: Thu, 17 Jul 2008 04:20:07 -0700 (PDT)
From: "souporpower@gmail.com" <soup_or_power@yahoo.com>
Subject: Re: Which domain registrar best for perl scripting?
Message-Id: <7bf3bbbe-70d7-42a3-8aaa-eebcbbc525ad@59g2000hsb.googlegroups.com>

On Jul 16, 4:05=A0pm, smallpond <smallp...@juno.com> wrote:
> souporpo...@gmail.com wrote:
> > Hi
>
> > I have written some perl scripts using the following packages:
>
> > =A0URI::URL;
> > =A0LWP::UserAgent;
> > =A0HTTP::Request;
> > =A0HTTP::Request::Common;
> > =A0HTTP::Request::Form;
> > =A0HTTP::Cookies;
> > =A0HTML::TreeBuilder 3.0;
> > =A0WWW::Mechanize;
>
> > I want to put my perl scripts on a hosted domain. When one of the
> > domain registrars Godaddy was contacted, they techies told me they
> > won't support Mechanize among other things.
> > So I tried another registrar namecheap.com who did support the modules
> > I need, however, won't let me run my scripts because of their high CPU
> > usage. Currently my domain with namecheap.com is suspended.
>
> > I don't want to make the same mistakes again. Can anyone tell me which
> > registrar is best for high performance perl scripts? Is Yahoo good?
> > They list the perl modules at their site, but I didn't see Mechanize.
>
> > Thanks for your help
>
> You first need to understand the difference between a domain registrar an=
d
> a web host - they are two different things. =A0Web hosting companies will
> tell you the level of service they provide at what cost. =A0"Free" websit=
es
> provided by domain registrars are worth the price you pay for them.
>
> --S
> ** Posted fromhttp://www.teranews.com**- Hide quoted text -
>
> - Show quoted text -

Hi "S"

Sorry I was unclear. Yes, you are right. I need a good hosting company
that will provide the modules I have requested.

Thanks


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

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:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#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 1727
***************************************


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