[32050] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3314 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 10 09:09:32 2011

Date: Thu, 10 Mar 2011 06:09:10 -0800 (PST)
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, 10 Mar 2011     Volume: 11 Number: 3314

Today's topics:
    Re: "getting" a website <jurgenex@hotmail.com>
    Re: "getting" a website <Uno@example.invalid>
    Re: "getting" a website <jurgenex@hotmail.com>
    Re: "getting" a website <Uno@example.invalid>
    Re: "getting" a website <Uno@example.invalid>
    Re: "getting" a website <jurgenex@hotmail.com>
    Re: "getting" a website <tadmc@seesig.invalid>
        Autovivification (was: contexts) <hjp-usenet2@hjp.at>
    Re: Autovivification <uri@StemSystems.com>
    Re: contexts (Alan Curry)
    Re: contexts <uri@StemSystems.com>
    Re: contexts <hjp-usenet2@hjp.at>
    Re: how to extract the string part between the two mark <jurgenex@hotmail.com>
        xml-rpc cgi client/server <nospam.gravitalsun@hotmail.com.nospam>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 09 Mar 2011 17:33:18 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: "getting" a website
Message-Id: <48agn6pn5mao0kum7vlmoce65p4479vsad@4ax.com>

Uno <Uno@example.invalid> wrote:
>On 03/08/2011 08:32 PM, Keith Keller wrote:
>> If that's wrong then you need to explain exactly what "serializing" a
>> website means.
>
>By "serialize," I mean have a faithful representation of both the 
>directories and the files.

That is impossible if you are limited to access by HTTP. 

HTTP does not know about directories or files, it knows only about URLs.
And a URL may map to anything or everything on the server, from
primitive static files over SSI or "dynamic web pages" to responses that
are generated on the fly by the server and never exist as a file or
anything even remotly resembling a file.

And if you are not limited to access by HTTP then use that access and
this whole discussion becomes pointless.

jue


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

Date: Wed, 09 Mar 2011 19:02:22 -0700
From: Uno <Uno@example.invalid>
Subject: Re: "getting" a website
Message-Id: <8tqppgFe43U1@mid.individual.net>

On 03/09/2011 02:02 PM, Jim Gibson wrote:
> In article<8tq3htFg9iU1@mid.individual.net>, Uno<Uno@example.invalid>
> wrote:
>
>> Out of curiosity, can somebody tell where this server is, physically?
>
> Wayne, Pennsylvania?
>
> <http://www.melissadata.com/lookups/iplocation.asp?ipaddress=74.208.40.6
> 0>
> <http://www.geobytes.com/IpLocator.htm?GetLocation>
> <http://www.geobytes.com/IpLocator.htm?GetLocation>
>
> Please limit your posts to discussions of Perl. Thank you.
>

Right, Jim, and I appreciate the forum's forbearance on a thread with me 
beginning with an emotional drunkpost.  I try to bring the discussion 
back to the topic by my own efforts, which were doubly successful today:

$ pwd
/home/dan/source/cookbook.examples/ch18/www.merrillpjensen.com
$ ls
colorschemes  img0.png    live_tinc.js  style1.css
images        index.html  main.css      style.css
$ perl gurl6.pl
Can't open perl script "gurl6.pl": No such file or directory
$ cd ..
$ perl gurl6.pl
Name "main::remotefile" used only once: possible typo at gurl6.pl line 18.
$ ls
ch18.code  expn  gurl6.pl  hostaddrs  mxhost  www.merrillpjensen.com 
zax.html
$ cat zax.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
 ...


HUGE SNIP

 ...
</body>
</noframes>
</frameset>
</html>
$ cat gurl6.pl
#!/usr/bin/perl -w
# gurl - get content from an url

use LWP::Simple;
require HTML::TokeParser;
use Net::FTP;

my $domain = 'www.merrillpjensen.com';
my $username = 'u61210220';
my $password = '';
my $file = 'index.html';
my $file2 = 'zax.html';

$ftp = Net::FTP->new($domain)    or die "Can't connect: $@\n";
$ftp->login($username, $password)       or die "Couldn't login\n";

$ftp->get($file, $file2)
     or die "Can't fetch $remotefile : $!\n";

# end output and script listing

So this is my site, which I bought from 1and1, who just happen to be my 
uncle's provider as well.  Lucky breaks fall to those who break things 
for a living, only to improve them after the demo portion.

What was the remote server telling me here:?

Name "main::remotefile" used only once: possible typo at gurl6.pl line 18.
-- 
Uno





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

Date: Wed, 09 Mar 2011 18:20:49 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: "getting" a website
Message-Id: <r0dgn65i04a1j69kqqpm433gafkc27c8mj@4ax.com>

Uno <Uno@example.invalid> wrote:
[...]
>     or die "Can't fetch $remotefile : $!\n";
>
>Name "main::remotefile" used only once: possible typo at gurl6.pl line 18.
>What was the remote server telling me here:?

Nothing.
This has nothing to do with a remote server but is a warning from perl
which is telling you, that you are using the variable $remotefile only
once:
- you are not declaring the variable (which begs the question why aren't
you using strict? Had you used strict then perl would have told you)
- you are not defining this variable anywhere
- and you are using it only once in this one line. 
And because you never assign any value to $remotefile you can just as
well remove it completely from the die statement.

jue


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

Date: Thu, 10 Mar 2011 02:08:13 -0700
From: Uno <Uno@example.invalid>
Subject: Re: "getting" a website
Message-Id: <8trinuFftmU1@mid.individual.net>

On 03/09/2011 07:20 PM, Jürgen Exner wrote:
> Uno<Uno@example.invalid>  wrote:
> [...]
>>      or die "Can't fetch $remotefile : $!\n";
>>
>> Name "main::remotefile" used only once: possible typo at gurl6.pl line 18.
>> What was the remote server telling me here:?
>
> Nothing.
> This has nothing to do with a remote server but is a warning from perl
> which is telling you, that you are using the variable $remotefile only
> once:
> - you are not declaring the variable (which begs the question why aren't
> you using strict? Had you used strict then perl would have told you)
> - you are not defining this variable anywhere
> - and you are using it only once in this one line.
> And because you never assign any value to $remotefile you can just as
> well remove it completely from the die statement.

I think I understand:

$ pwd
/home/dan/source/cookbook.examples/ch18
$ perl gurl6.pl
$ ls
ch18.code  gurl6.pl   mxhost                  zax2.html
expn       hostaddrs  www.merrillpjensen.com  zax.html
$ cat gurl6.pl
#!/usr/bin/perl -w
# gurl - get content from an url

use LWP::Simple;
require HTML::TokeParser;
use Net::FTP;

my $domain = 'www.merrillpjensen.com';
my $username = 'u61210220';
my $password = '';
my $file = 'index.html';
my $file2 = 'zax2.html';

$ftp = Net::FTP->new($domain)    or die "Can't connect: $@\n";
$ftp->login($username, $password)       or die "Couldn't login\n";

$ftp->get($file, $file2)
     or die "Can't fetch $file : $!\n";

$

Wenn ich also "tja" sagte, koenntest Du behaupten, dass ich etwa die 
Pfade verloren habe.  Allerdings existeirt ein neues Datei zax2.

Mir geschieht das recht.
-- 
Uno


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

Date: Thu, 10 Mar 2011 03:18:05 -0700
From: Uno <Uno@example.invalid>
Subject: Re: "getting" a website
Message-Id: <8trmqvFe7vU1@mid.individual.net>

On 03/07/2011 06:34 PM, Tad McClellan wrote:

>
> Tips on how to do what, exactly?
>
>
> And how do expect to use Perl for whatever it is that you do mean to do?
>
> Ask us a question about Perl, and we will answer it.
>
>

I'm looking for a reference in _Learning Perl_. which I bought at your 
recommendation.

This is a matching control:

> while (<FILE2>) {
> if (m{
> http://www.germanresistance.com/documents # first part
> .*  #anything in between
> pdf # last part
> }six)  {
> print $_;
> }
> }

[had to print as quotation which makes me feel like mao tse dong: 
antiquated}

What if I wanted to match on zip as well?  I've been looking through 
that book, and in want of better advice, find it to be a family argument 
with cavemen.

On the one hand, the "fred, dino, or barney stuff" isn't quite cutting 
it for me, because I can't find the page I read the original material on 
in _Learning Perl_.

I believe the part that needs expansion is:

 > pdf # last part

q43)  How do I match on zip as well?

Also, presumably q44, why did $_ return more than I wanted?

Gruesst euch.
-- 
Uno


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

Date: Thu, 10 Mar 2011 03:24:36 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: "getting" a website
Message-Id: <d6dhn6da89kj9ab8m65don2likes71vugs@4ax.com>

Uno <Uno@example.invalid> wrote:

>q43)  How do I match on zip as well?

perldoc perlretut
perldoc perlre

jue


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

Date: Thu, 10 Mar 2011 07:35:22 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: "getting" a website
Message-Id: <slrninhkj8.6bk.tadmc@tadbox.sbcglobal.net>

Uno <Uno@example.invalid> wrote:
> On 03/07/2011 06:34 PM, Tad McClellan wrote:
>
>>
>> Tips on how to do what, exactly?

> I'm looking for a reference in _Learning Perl_. 


There are 5 editions of the Llama book, so page references are
not possible without knowing which edition...

It surely covers "Grouping" and "Alternation", which is what
you are looking for.


> which I bought at your 
> recommendation.


Books are never a first resource.

The docs that come with the perl distribution are a first resource.

For basic regular expression constructs, this std doc would seem to be it:

    perlretut - Perl regular expressions tutorial


It has 2 sections that would be germane here:

    Matching this or that
    Grouping things and hierarchical matching


> This is a matching control:
>
>> while (<FILE2>) {
>> if (m{
>> http://www.germanresistance.com/documents # first part
>> .*  #anything in between
>> pdf # last part
>> }six)  {
>> print $_;
>> }
>> }


> I believe the part that needs expansion is:
>
> > pdf # last part


Most excellent! You have found the right spot.


> q43)  How do I match on zip as well?


By adding alternation and grouping:

    (pdf|zip) # last part

or, since you are already using the m//x modifier:

    (               # last part (will be available in $1)
        pdf | zip   # either one of these
    )

or, if you don't need to capture:

    (?:              # last part
         pdf | zip   # either one of these
    )

> Also, presumably q44, why did $_ return more than I wanted?


$_ is a variable. 

It cannot "return" anything. 

It does have a value though:

    why is the value of $_ more than I wanted.


For us to answer that, we would need to know what you wanted!

What did you want?


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Thu, 10 Mar 2011 09:50:08 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Autovivification (was: contexts)
Message-Id: <slrninh461.mlu.hjp-usenet2@hrunkner.hjp.at>

On 2011-03-09 19:20, C.DeRykus <derykus@gmail.com> wrote:
> On Mar 8, 2:48 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
>> Well I'm rarely surprised by Perl, too. But then I've now used it for 16
>> years (and discussed it on Usenet for nearly as long), so it shouldn't.
>> But there are still some aspects of the language which I do not find
>> intuitive. For example (since we were talking about references)
>> autovivification. Referencing $x->[0][0] automatically creates $x->[0]
>> as a reference to an empty array, but @{ $x->[0] } throws an exception.
>> Why? Both cases seem almost exactly analogous to me.
>>
>
> Hm, both of the cases below just throw warnings
> and the latter warning is more explicit.

I see I was a bit short on context.

The situation with @{} was something like this:

#!/usr/bin/perl
use warnings;
use strict;

my $x = [];

if (@{ $x->[0] }) {
    print "do something\n";
} else {
    print "do something else\n";
}
__END__
Can't use an undefined value as an ARRAY reference at ./ref1 line 7.

So  $x->[0] does not exist but should clearly be an arrayref. The
program dies with an exception, the element is not autovivified.

Compare this with:

#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;

my $x = [];

if ($x->[0][0]) {
    print "do something\n";
} else {
    print "do something else\n";
    print Dumper $x;
}
__END__
do something else
$VAR1 = [
          []
        ];

Again, $x->[0] does not exist but should clearly be an arrayref.
In this case, however, the element is autovivified and the program does
not die. 

Why? I don't see the difference. In both cases the element doesn't exist
but the type is clear (so it would be possible to autovivify it). In
both cases there is no explicit assignment, only a read access (so it is
debatable whether the element should be autovivified at all - it isn't
necessary to determine the value of the expression and it is unintuitive
that a read access modifies a value). The main difference  is that 
@{ $x->[0] } queries a property of the anonyous array itself, and
$x->[0][0]queries a property of one of its elements. But I don't think
this should influence the behaviour. 

	hp



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

Date: Thu, 10 Mar 2011 04:28:05 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Autovivification
Message-Id: <87k4g7pboa.fsf@quad.sysarch.com>

>>>>> "PJH" == Peter J Holzer <hjp-usenet2@hjp.at> writes:

  PJH> On 2011-03-09 19:20, C.DeRykus <derykus@gmail.com> wrote:
  >> On Mar 8, 2:48 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
  >>> Well I'm rarely surprised by Perl, too. But then I've now used it for 16
  >>> years (and discussed it on Usenet for nearly as long), so it shouldn't.
  >>> But there are still some aspects of the language which I do not find
  >>> intuitive. For example (since we were talking about references)
  >>> autovivification. Referencing $x->[0][0] automatically creates $x->[0]
  >>> as a reference to an empty array, but @{ $x->[0] } throws an exception.
  >>> Why? Both cases seem almost exactly analogous to me.
  >>> 
  >> 
  >> Hm, both of the cases below just throw warnings
  >> and the latter warning is more explicit.

  PJH> I see I was a bit short on context.

  PJH> The situation with @{} was something like this:

  PJH> #!/usr/bin/perl
  PJH> use warnings;
  PJH> use strict;

  PJH> my $x = [];

  PJH> if (@{ $x->[0] }) {
  PJH>     print "do something\n";
  PJH> } else {
  PJH>     print "do something else\n";
  PJH> }
  PJH> __END__
  PJH> Can't use an undefined value as an ARRAY reference at ./ref1 line 7.

  PJH> So  $x->[0] does not exist but should clearly be an arrayref. The
  PJH> program dies with an exception, the element is not autovivified.

  PJH> Compare this with:

  PJH> #!/usr/bin/perl
  PJH> use warnings;
  PJH> use strict;
  PJH> use Data::Dumper;

  PJH> my $x = [];

  PJH> if ($x->[0][0]) {
  PJH>     print "do something\n";
  PJH> } else {
  PJH>     print "do something else\n";
  PJH>     print Dumper $x;
  PJH> }
  PJH> __END__
  PJH> do something else
  PJH> $VAR1 = [
  PJH>           []
  PJH>         ];

  PJH> Again, $x->[0] does not exist but should clearly be an arrayref.
  PJH> In this case, however, the element is autovivified and the program does
  PJH> not die. 


  PJH> Why? I don't see the difference. In both cases the element doesn't exist
  PJH> but the type is clear (so it would be possible to autovivify it). In
  PJH> both cases there is no explicit assignment, only a read access (so it is
  PJH> debatable whether the element should be autovivified at all - it isn't
  PJH> necessary to determine the value of the expression and it is unintuitive
  PJH> that a read access modifies a value). The main difference  is that 
  PJH> @{ $x->[0] } queries a property of the anonyous array itself, and
  PJH> $x->[0][0]queries a property of one of its elements. But I don't think
  PJH> this should influence the behaviour. 

i said this in another post. something needs to be assigned. or rather
an lvalue context is needed. this is from perlref:

	This is one of the cases we mentioned earlier in which
        references could spring into existence when in an lvalue
        context.

your first case is read only. the second one makes the top level array
an lvalue since it needs an array ref in there to lookup the element in
the next level. autivivification happens when you must have a ref or the
whole expression dies. just reading a top level ref or deref like print
@{$ref->[0]} isn't enough. pushing to that expression is enough as the
missing array ref is now being used to store data so it is an lvalue.

it does make sense when you think about it in an lvalue context.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 9 Mar 2011 22:00:22 +0000 (UTC)
From: pacman@kosh.dhis.org (Alan Curry)
Subject: Re: contexts
Message-Id: <il8t9l$2ll$1@speranza.aioe.org>

In article <8b8f1184-840a-41dc-9525-ee045e9e20b8@a11g2000pri.googlegroups.com>,
C.DeRykus <derykus@gmail.com> wrote:
>On Mar 8, 2:48 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
>> autovivification. Referencing $x->[0][0] automatically creates $x->[0]
>> as a reference to an empty array, but @{ $x->[0] } throws an exception.
>> Why? Both cases seem almost exactly analogous to me.
>>
>
>Hm, both of the cases below just throw warnings
>and the latter warning is more explicit. However,
>an anonymous array does get created:
>
>
>  perl   -wle "print $x->[0][0],'foo'"
>  Name "main::x" used only once: possible typo at -e line 1.
>  Use of uninitialized value in print at -e line 1.
>  foo
>
>  perl   -wle "print @{$x->[0]},'foo'"
>  Name "main::x" used only once: possible typo at -e line 1.
>  Use of uninitialized value in array dereference at -e line 1.
>  foo

But the second case fails to compile with use strict in effect, so you
can't use it if you're trying to be respectable.

$ perl -Mstrict -wle 'my $x; print @{$x->[0]}, "foo"'
Can't use an undefined value as an ARRAY reference at -e line 1.

And it's not because $x is lexical.

$ perl -Mstrict -wle 'print @{$::x->[0]}, "foo"'
Name "main::x" used only once: possible typo at -e line 1.
Can't use an undefined value as an ARRAY reference at -e line 1.
$ perl -Mstrict -wle 'print @{$_->[0]}, "foo"'
Can't use an undefined value as an ARRAY reference at -e line 1.

But if you're doing something other than printing it, it works:

$ perl -Mstrict -wle 'push @{$_->[0]}, "foo"; print $_->[0][0]'
foo

Apparently the @{...} operator knows the difference between "push
context" and "print context". Did someone say contexts aren't confusing?

-- 
Alan Curry


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

Date: Wed, 09 Mar 2011 17:51:57 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: contexts
Message-Id: <871v2fuctu.fsf@quad.sysarch.com>

>>>>> "AC" == Alan Curry <pacman@kosh.dhis.org> writes:

  AC> In article <8b8f1184-840a-41dc-9525-ee045e9e20b8@a11g2000pri.googlegroups.com>,
  AC> C.DeRykus <derykus@gmail.com> wrote:
  >> On Mar 8, 2:48 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
  >>> autovivification. Referencing $x->[0][0] automatically creates $x->[0]
  >>> as a reference to an empty array, but @{ $x->[0] } throws an exception.
  >>> Why? Both cases seem almost exactly analogous to me.
  >> 
  >> Hm, both of the cases below just throw warnings
  >> and the latter warning is more explicit. However,
  >> an anonymous array does get created:
  >> 
  >> perl   -wle "print $x->[0][0],'foo'"
  >> Name "main::x" used only once: possible typo at -e line 1.
  >> Use of uninitialized value in print at -e line 1.
  >> foo
  >> 
  >> perl   -wle "print @{$x->[0]},'foo'"
  >> Name "main::x" used only once: possible typo at -e line 1.
  >> Use of uninitialized value in array dereference at -e line 1.
  >> foo

  AC> But the second case fails to compile with use strict in effect, so you
  AC> can't use it if you're trying to be respectable.

  AC> $ perl -Mstrict -wle 'my $x; print @{$x->[0]}, "foo"'
  AC> Can't use an undefined value as an ARRAY reference at -e line 1.

  AC> And it's not because $x is lexical.

  AC> $ perl -Mstrict -wle 'print @{$::x->[0]}, "foo"'
  AC> Name "main::x" used only once: possible typo at -e line 1.
  AC> Can't use an undefined value as an ARRAY reference at -e line 1.
  AC> $ perl -Mstrict -wle 'print @{$_->[0]}, "foo"'
  AC> Can't use an undefined value as an ARRAY reference at -e line 1.

  AC> But if you're doing something other than printing it, it works:

  AC> $ perl -Mstrict -wle 'push @{$_->[0]}, "foo"; print $_->[0][0]'
  AC> foo

  AC> Apparently the @{...} operator knows the difference between "push
  AC> context" and "print context". Did someone say contexts aren't confusing?

actually it is more about using the autovivified value by assigning to
it that makes a difference. this is a very useful and no warning idiom:

	push( @{$obj->{stuff}}, $stuff ) ;

that is very different than printing the deref expression as print
doesn't assign into the array. you are dereferencing undef but not
making use of it by assigning something to the newly created ref. that
is likely a mistake so it warns.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Thu, 10 Mar 2011 10:13:27 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: contexts
Message-Id: <slrninh5ho.mlu.hjp-usenet2@hrunkner.hjp.at>

On 2011-03-08 23:13, Uri Guttman <uri@StemSystems.com> wrote:
>>>>>> "PJH" == Peter J Holzer <hjp-usenet2@hjp.at> writes:
>
>  PJH> On 2011-03-08 14:47, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>  >>>>>>> "Charlton" == Charlton Wilbur <cwilbur@chromatico.net> writes:
>  >> 
>  Charlton> The core of the commentary is that flattening lists in Perl4
>  Charlton> was a bad decision because it makes hierarchical data
>  Charlton> structures difficult,
>  >> 
>  >> But it made sense since Perl4 didn't have hierarchical data structures!
>  >> 
>  >> That statement makes about as much sense as
>  >> 
>  >> "Perl4 didn't have elephant harnesses, so it made dealing with
>  >> elephants difficult."
>  >> 
>  >> Uh yeah.  Not designed for that.
>
>  PJH> True, but "not designed for that" is exactly the problem. A programming
>  PJH> language without hierarchical data structures is of limited utility.
>
>  PJH> If Larry had planned to design a general purpose programming language,
>  PJH> he would have included hierarchical data structures from the beginning.
>  PJH> But he didn't. He just wanted a simple language to replace shell and
>  PJH> awk. So he left them out. But people who started to use Perl for the
>  PJH> simple tasks it was designed for soon wanted to use it for more complex
>  PJH> tasks and discovered that that was hard without hierarchical data
>  PJH> structures.
>
> and you can do hierarchal stuff in perl4. i did a major 6 month project
> doing just that. i had to hack my own tree stuff from a large array and
> joined strings of index numbers, and typeglobs and supporting subs.

Yes, of course you can do it. You can do it in machine code (obviously)
and all you have in machine code is a single large array of bytes. 

I didn't say it was impossible, just hard. And "hard" doesn't even mean
intellectually challenging here, just tedious. 

> it just is much easier, faster and cleaner with perl5.

Yup.


>  PJH> So they had to be added.
>
> they had to be improved by adding refs and objects.

Nope. They were added to language. Perl didn't have them before. You
could build them on top of the existing data structures, of course, just
as you could build them in assembler or even a Turing machine (now
that's tedious), but support for them in the language made it easier,
faster and cleaner (which is what high level languages are about).

	hp


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

Date: Wed, 09 Mar 2011 17:42:37 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: how to extract the string part between the two marks
Message-Id: <foagn616g815kh4j7jdnudpql0ihc77c06@4ax.com>

"Beno" <Beno.R@gmail.com> wrote:
>Not to remove, I need to extract the tekst 12:30
>
>> how to remove the string part between the two marks
>> for example
>> from string "<DIV> </ DIV> <SPAN ID=TIME> 12:30 </ SPAN> <SOME TEXT>"
>> extract the text "12:30"
[...]
>> I know that there is an easier way in Perl, but how?

For a very simple-minded approach use 

	if ($string =~ m+<SPAN ID=TIME> (.*) </SPAN>+) {
		print $1;
	}

Of course this will fail as soon as the SPAN tag changes, even it is
just some change in whitespace, or someone decided to enclose TIME in
quotes, or changes SPAN to lower-case, or or or....

The correct way is -as has been said a gazillion times in this NG- use
an HTML parser to parse HTML and then simply retrieve the body of the
SPAN tag.

jue 


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

Date: Thu, 10 Mar 2011 10:32:23 +0200
From: "George Mpouras" <nospam.gravitalsun@hotmail.com.nospam>
Subject: xml-rpc cgi client/server
Message-Id: <ila29k$3137$1@news.ntua.gr>

If you want an other one, goto comp.lang.perl.modules  for the relative post 




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

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 3314
***************************************


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