[28425] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9789 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 2 11:06:00 2006

Date: Mon, 2 Oct 2006 08:05:13 -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           Mon, 2 Oct 2006     Volume: 10 Number: 9789

Today's topics:
    Re: can't locate method new IO::Socket::INET <brent.honadel@lawson.com>
    Re: can't locate method new IO::Socket::INET <bart@nijlen.com>
        case insensitive hash lookup <jack_posemsky@yahoo.com>
    Re: case insensitive hash lookup <aukjan@vanbelkum.no.spam.nl>
    Re: case insensitive hash lookup <jurgenex@hotmail.com>
    Re: how can I print multiple lines without escaping '$' <tzz@lifelogs.com>
        How to make 2 dimensinal aray in Perl  $mat(x,y)? <joza@tundre.tr>
    Re: How to make 2 dimensinal aray in Perl  $mat(x,y)? <noreply@gunnar.cc>
    Re: How to make 2 dimensinal aray in Perl  $mat(x,y)? (reading news)
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <betterdie@gmail.com>
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <traggatt@gmail.com>
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? anno4000@radom.zrz.tu-berlin.de
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <traggatt@gmail.com>
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <bik.mido@tiscalinet.it>
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <bik.mido@tiscalinet.it>
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <traggatt@gmail.com>
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <David.Squire@no.spam.from.here.au>
    Re: How to make 2 dimensinal aray in Perl $mat(x,y)? <tadmc@augustmail.com>
    Re: how to read last row in a datafile ? (reading news)
    Re: how to read last row in a datafile ? <bart@nijlen.com>
        LWP and Unicode <dale.gerdemann@googlemail.com>
    Re: LWP and Unicode <dale.gerdemann@googlemail.com>
    Re: Modifying a one-liner beartiger@gmail.com
    Re: Modifying a one-liner <tzz@lifelogs.com>
    Re: My first socket question <bik.mido@tiscalinet.it>
        New Perl Mongers Group (Orlando, FL, USA) <buff3r@gmail.com>
    Re: newbie syntax question -> and => usenet@DavidFilmer.com
    Re: newbie syntax question -> and => <news@lawshouse.org>
    Re: newbie syntax question -> and => <bik.mido@tiscalinet.it>
    Re: newbie syntax question -> and => <tadmc@augustmail.com>
    Re: newbie syntax question -> and => <rvtol+news@isolution.nl>
    Re: newbie syntax question -> and => <bik.mido@tiscalinet.it>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 2 Oct 2006 07:15:22 -0700
From: "ten8ciousb" <brent.honadel@lawson.com>
Subject: Re: can't locate method new IO::Socket::INET
Message-Id: <1159798522.802033.267920@e3g2000cwe.googlegroups.com>


Sisyphus wrote:
> "ten8ciousb" <brent.honadel@lawson.com> wrote in message
> .
> .
> >  All I did was add print statements.  Now, same site but
> > a new server and the print statements aren't helping anymore.
> >
>
> Sounds like something might be configured a little differently on the new
> server and the print()ing is going somewhere else. Try opening a filehandle
> to a log file, and have the debug statements print() to that filehandle.
>
> (Or perhaps those print statements are already being written to some error
> log ?)
>

I only mentioned the print statements because I thought it was strange
that they magically made the problem go away.  The debugging print
statements still show up in the log, but whatever effect they were
having before, which prevented the "Can't locate.." message, they
aren't having now.  The only thing that I can think they did was slow
down the execution of the program.



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

Date: 2 Oct 2006 08:02:39 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: can't locate method new IO::Socket::INET
Message-Id: <1159801359.823786.230370@m73g2000cwd.googlegroups.com>

ten8ciousb wrote:

> Sometimes, not always, an attempt to create a new socket connection
> fails with this message:
> Socket::INET" (perhaps you forgot to load "IO::Socket::INET"?) at
> /usr/local/lib/perl5/5.6.1/IO/Socket/INET.pm line 32

You could use  eval  to check whether a module is loaded:

  eval ('use aModule;');
  die 'aModule not loaded' if $@;

> Any ideas why or how INET.pm fails saying it can't find new in INET.pm?
> The script runs on many servers many times a day, but only fails on one
> and generally about the same time of the day.   Okay.  Seems kind of
> obvious that is something specific to the server and the time of day.
> But, within the same script there are multiple calls to create sockets
> to different servers and they complete successfully.
>
> I'm kind of out of my element on the internals of perl here, but my
> thoughts:
> Is it trying to find IO::Socket::INET.pm in @INC in order to identify
> the super class, which is IO::Socket?
> Does that mean that @INC has somehow become 'corrupted' during runtime?
>
> any other thoughts.
> Or has perl's symbol table become corrupted so it doesn't know what
> "new" is?

Not sure if this would make any difference, but saying  use lib
'/path/to/...';  in the beginning of your script wouldn't harm.

You could also tell the program to explicitly run under Perl 5.6.1.

Maybe there is a lock or buffering issue while reading INET.pm into
memory with mutliple sockets. There's a note from the IO::Socket and
IO::Socket::INET man pages saying:

     "As of VERSION 1.18 all IO::Socket objects have autoflush turned
      on by default. This was not the case with earlier releases."

Just some ideas - maybe it helps.

-- 
 Bart



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

Date: 2 Oct 2006 07:35:23 -0700
From: "Jack" <jack_posemsky@yahoo.com>
Subject: case insensitive hash lookup
Message-Id: <1159799723.336736.129560@i3g2000cwc.googlegroups.com>

Hello,

I noticed the hash lookup code below doesnt allow for case insensitive
nor pattern match lookups.. I want to essentially be able to do the
same as this (notice the "i"):
if ($temp2  =~ m/Abdomen/i) {  print " case insensitive pattern matched
!  "; }
with my hash lookup:
if (exists $hash{$temparray2[$sourcefield]}) {  print " exact match
found only "  }

Does anyone know how to accomplish this.

Thank you,

Jack



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

Date: Mon, 02 Oct 2006 16:42:22 +0200
From: Aukjan van Belkum <aukjan@vanbelkum.no.spam.nl>
Subject: Re: case insensitive hash lookup
Message-Id: <158a5$4521254f$c2abfc64$24859@news1.tudelft.nl>

Jack wrote:
> Hello,
> 
> I noticed the hash lookup code below doesnt allow for case insensitive
> nor pattern match lookups.. I want to essentially be able to do the
> same as this (notice the "i"):
> if ($temp2  =~ m/Abdomen/i) {  print " case insensitive pattern matched
> !  "; }
> with my hash lookup:
> if (exists $hash{$temparray2[$sourcefield]}) {  print " exact match
> found only "  }
> 

If you just wish to use the lowercase value as a hash key, you can use 
the Perl function 'lc' ( perldoc -f lc ). This will return the lowercase 
of the value given:

if ( exists $hash{ lc( $temparray2[$sourcefield] ) } {
	print " Lowercase key exists in hash";
}


Aukjan


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

Date: Mon, 02 Oct 2006 14:58:01 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: case insensitive hash lookup
Message-Id: <ZN9Ug.16041$Oh3.3413@trnddc04>

Jack wrote:
> I noticed the hash lookup code below doesnt allow for case insensitive
> nor pattern match lookups..[...]
>
> Does anyone know how to accomplish this.

Simple, just use a normal form, e.g. all upper case or all lower case as the 
key.

jue 




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

Date: Mon, 02 Oct 2006 10:26:23 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: how can I print multiple lines without escaping '$' and other characters?
Message-Id: <g694pumyesw.fsf@CN1374059D0130.kendall.corp.akamai.com>

On 29 Sep 2006, bennett@peacefire.org wrote:

> Suppose I want to print multiple lines of output which contain dollar
> signs.  The following will not work:
>
> print <<EOF ;
> A loaf of bread costs $1.
> A jug of milk costs $2.
> EOF
>
> because Perl will interpret the dollar signs.  How can I print it
> without having to put a backslash in front of every $ sign?
>
> For example, I want to write a Perl script that prints out another Perl
> script as output, I don't want to have to write the second Perl script
> once using dollar signs and other special characters, then go back and
> insert backslashes in front of every special character.

In addition to single-quoting the "EOF" marker as others have
suggested, you could use the __DATA__ marker:

while (<DATA>) { read in the data }

__DATA__
This is my script full of $ signs

I like this approach because it's very easy to open an external file
later by just replacing the file handle name.

Ted


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

Date: Mon, 2 Oct 2006 10:21:04 +0200
From: "Joza" <joza@tundre.tr>
Subject: How to make 2 dimensinal aray in Perl  $mat(x,y)?
Message-Id: <efqi5k$2ms$1@ss408.t-com.hr>

How to make 2 dimensinal aray in Perl $mat(x,y)?

Thanks




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

Date: Mon, 02 Oct 2006 10:32:18 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to make 2 dimensinal aray in Perl  $mat(x,y)?
Message-Id: <4oc14jFds39qU1@individual.net>

Joza wrote:
> How to make 2 dimensinal aray in Perl $mat(x,y)?

     perldoc perlintro

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


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

Date: Mon, 02 Oct 2006 10:15:48 GMT
From: "Mumia W. (reading news)" <paduille.4058.mumia.w@earthlink.net>
Subject: Re: How to make 2 dimensinal aray in Perl  $mat(x,y)?
Message-Id: <oF5Ug.9008$UG4.7496@newsread2.news.pas.earthlink.net>

On 10/02/2006 03:21 AM, Joza wrote:
> How to make 2 dimensinal aray in Perl $mat(x,y)?
> 
> Thanks
> 
> 

perldoc perllol

-- 
Posting Guidelines for comp.lang.perl.misc:
http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: 2 Oct 2006 02:01:12 -0700
From: "paul" <betterdie@gmail.com>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <1159779672.403664.206890@b28g2000cwb.googlegroups.com>

You can check in Perl doc along with the installation..


Gunnar Hjalmarsson wrote:
> Joza wrote:
> > How to make 2 dimensinal aray in Perl $mat(x,y)?
>
>      perldoc perlintro
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: 2 Oct 2006 02:48:53 -0700
From: "tim" <traggatt@gmail.com>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <1159782533.449551.195750@i42g2000cwa.googlegroups.com>

Hello

The syntax is like so:

$mat[x][y]

where x and y are >= 0


Joza wrote:
> How to make 2 dimensinal aray in Perl $mat(x,y)?
> 
> Thanks



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

Date: 2 Oct 2006 10:11:36 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <4oc6uoFdui1oU1@news.dfncis.de>

tim <traggatt@gmail.com> wrote in comp.lang.perl.misc:
> Joza wrote:

[top posting corrected, please don't do that]

> > How to make 2 dimensinal aray in Perl $mat(x,y)?
> > 
> > Thanks

> Hello
> 
> The syntax is like so:
> 
> $mat[x][y]

That's not Perl, unless x and y are predefined functions, constants
for example.  Also, your syntax is already a simplification.  The
correct syntax is

    $mat[ $x]->[ $y]

Strictly speaking, even that is a simplification.  The basic syntax is

    ${ $mat[ $x] }[ $y]

> where x and y are >= 0

Wrong.  Perl allows access through negative indices.

Anno


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

Date: 2 Oct 2006 04:20:47 -0700
From: "tim" <traggatt@gmail.com>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <1159788047.553984.114810@m73g2000cwd.googlegroups.com>

sure, i realise that x and y aren't proper perl variables, i just used
them because Joza did in his post!

didn't know about the negative array indices though - thanks for that!


anno4000@radom.zrz.tu-berlin.de wrote:
> tim <traggatt@gmail.com> wrote in comp.lang.perl.misc:
> > Joza wrote:
>
> [top posting corrected, please don't do that]
>
> > > How to make 2 dimensinal aray in Perl $mat(x,y)?
> > >
> > > Thanks
>
> > Hello
> >
> > The syntax is like so:
> >
> > $mat[x][y]
>
> That's not Perl, unless x and y are predefined functions, constants
> for example.  Also, your syntax is already a simplification.  The
> correct syntax is
>
>     $mat[ $x]->[ $y]
>
> Strictly speaking, even that is a simplification.  The basic syntax is
>
>     ${ $mat[ $x] }[ $y]
>
> > where x and y are >= 0
> 
> Wrong.  Perl allows access through negative indices.
> 
> Anno



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

Date: 2 Oct 2006 15:16:43 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <n442i25frojcjdp27e6lcadlgg6qqmrakl@4ax.com>

On 2 Oct 2006 02:01:12 -0700, "paul" <betterdie@gmail.com> wrote:

>You can check in Perl doc along with the installation..
>
>
>Gunnar Hjalmarsson wrote:

*PLEASE* do not top-post!

>> Joza wrote:
>> > How to make 2 dimensinal aray in Perl $mat(x,y)?
>>
>>      perldoc perlintro
[snip full quoted .sig]

I fail to make full sense of your remark syntactically. To make any
sense of it, semantically. How is this a comment to Gunnar's answer?
And what does it add to it?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 2 Oct 2006 15:18:21 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <ba42i2pav4eevaeg9jph0bvv3ac46m3q5n@4ax.com>

On 2 Oct 2006 04:20:47 -0700, "tim" <traggatt@gmail.com> wrote:

>sure, i realise that x and y aren't proper perl variables, i just used
>them because Joza did in his post!
>
>didn't know about the negative array indices though - thanks for that!
>
>
>anno4000@radom.zrz.tu-berlin.de wrote:
[snip full quoted content]

Thank you in advance for not top-posting next time! You won't, will
you?!?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 2 Oct 2006 07:12:42 -0700
From: "tim" <traggatt@gmail.com>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <1159798361.982232.248810@e3g2000cwe.googlegroups.com>

yup! sorry about before....

Michele Dondi wrote:
> On 2 Oct 2006 04:20:47 -0700, "tim" <traggatt@gmail.com> wrote:
>
> >sure, i realise that x and y aren't proper perl variables, i just used
> >them because Joza did in his post!
> >
> >didn't know about the negative array indices though - thanks for that!
> >
> >
> >anno4000@radom.zrz.tu-berlin.de wrote:
> [snip full quoted content]
>
> Thank you in advance for not top-posting next time! You won't, will
> you?!?
>
>
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,



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

Date: Mon, 02 Oct 2006 15:35:25 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <efr83d$f4r$1@gemini.csx.cam.ac.uk>

tim wrote:
> yup! sorry about before....
> 
> Michele Dondi wrote:
>>
>> Thank you in advance for not top-posting next time! You won't, will
>> you?!?

Tim, you did it again! If you don't know what top-posting is, please
read the posting guidelines for this group that are posted here twice
weekly (and are thus all over the archive at Google).

Not many chances left...


DS


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

Date: Mon, 2 Oct 2006 09:40:57 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to make 2 dimensinal aray in Perl $mat(x,y)?
Message-Id: <slrnei297p.ok5.tadmc@magna.augustmail.com>

tim <traggatt@gmail.com> wrote:

> sorry about before....


No you're not.

So long!


> Michele Dondi wrote:
>> On 2 Oct 2006 04:20:47 -0700, "tim" <traggatt@gmail.com> wrote:
>>
>> >sure, i realise that x and y aren't proper perl variables, i just used
>> >them because Joza did in his post!
>> >
>> >didn't know about the negative array indices though - thanks for that!
>> >
>> >
>> >anno4000@radom.zrz.tu-berlin.de wrote:
>> [snip full quoted content]
>>
>> Thank you in advance for not top-posting next time! You won't, will
>> you?!?
>>
>>
>> Michele
>> --
>> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
>> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
>> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
>> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
> 


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 02 Oct 2006 10:15:49 GMT
From: "Mumia W. (reading news)" <paduille.4058.mumia.w@earthlink.net>
Subject: Re: how to read last row in a datafile ?
Message-Id: <pF5Ug.9009$UG4.6872@newsread2.news.pas.earthlink.net>

On 10/01/2006 08:45 PM, Jack wrote:
> Hi there, does anyone know how to capture the last row in a datafile
> into a variable without having to read through each record of the
> entire file ?
> 
> Thank you,
> 
> Jack
> 

The database system determines how this is done or if it's even possible.

You could use the "order by" and "limit" clauses of a (my)SQL statement; 
however, this is not so much a Perl question as a database question.

-- 
Posting Guidelines for comp.lang.perl.misc:
http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 2 Oct 2006 07:08:04 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: how to read last row in a datafile ?
Message-Id: <1159798084.039609.272020@i3g2000cwc.googlegroups.com>

Jack wrote:

> Hi there, does anyone know how to capture the last row in a datafile
> into a variable without having to read through each record of the
> entire file ?

On UNIX (and some Windows versions):

  my $lastline = `tail -1 /path/to/file.txt`;

-- 
 Bart



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

Date: 2 Oct 2006 01:59:35 -0700
From: "Dale" <dale.gerdemann@googlemail.com>
Subject: LWP and Unicode
Message-Id: <1159779575.190215.153910@i3g2000cwc.googlegroups.com>

I have a couple of questions/problems concerning LWP and
Unicode. Here's an ultra-simple program that goes to a web page,
downloads it's contents and prints them out in a semi-readable form:

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

#!/.../perl-5.8.8/bin/perl -CSDA

use utf8;
use LWP;
use Encode;
use URI::Escape;

my $browser =3D LWP::UserAgent->new;
$browser->parse_head(0);

my $url =3D
'http://bg.wiktionary.org/wiki/=D0=A3=D0=B8=D0=BA=D0=B8=D1=80=D0=B5=D1=87=
=D0=BD=D0=B8=D0=BA:=D0=91=D1=8A=D0=BB=D0=B3=D0=B0=D1=80=D1=81=D0=BA=D0=B8/=
=D0=A2=D0=B8=D0=BF=D0=BE=D0=B2=D0=B5_=D0=B4=D1=83=D0=BC=D0=B8/=D0=93=D0=BB=
=D0=B0=D0=B3=D0=BE=D0=BB=D0=B8';
my $response =3D $browser->get(encode("utf8", $url));

my $content =3D decode("utf8", uri_unescape($response->content));

print "$content\n";

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

Question 1: Why do I need the line that says

   $browser->parse_head(0);


Question 2: Why do I need to explicitly say:

   decode("utf8", ...)

Isn't there a way to tell LWP that the content is utf8? Or more
precisely, that it is utf8 with some  URI percent escapes.


Question 3: If you change the pragma "use utf8" to "use encoding
'utf8'" then you don't need the call to "decode("utf8", ...)". Why
should this be? What's the difference between "use utf8" and "use
encoding 'utf8'"? The perldoc:perlunicode is no help here.


Question 4: In the original program, replace the line

   my $content =3D decode("utf8", uri_unescape($response->content));

with

   my $content =3D $response->content;
   utf8::upgrade($content);

The perldoc:perlunicode page says you should do this when, for some
reason, Unicode does not happen. But this does nothing for me. I still
end up with bytes.



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

Date: 2 Oct 2006 06:32:28 -0700
From: "Dale" <dale.gerdemann@googlemail.com>
Subject: Re: LWP and Unicode
Message-Id: <1159795948.809520.50940@i3g2000cwc.googlegroups.com>

One more question in a similar vein. Using HTML::LinkExtor on a page
using Unicode, I can't seem to process the page without at least one
warning of the form:

   Parsing of undecoded UTF-8 will give garbage when decoding entities
at ./verb_extorline 32.

The code I used was pretty straightforwardly modified from the
Cookbook:

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

#!.../perl-5.8.8/bin/perl -w -CSDA

use utf8;
use LWP::UserAgent;
use HTML::LinkExtor;
use URI::URL;
use Encode;
use URI::Escape;

my $url =3D
'http://bg.wiktionary.org/wiki/=D0=A3=D0=B8=D0=BA=D0=B8=D1=80=D0=B5=D1=87=
=D0=BD=D0=B8=D0=BA:=D0=91=D1=8A=D0=BB=D0=B3=D0=B0=D1=80=D1=81=D0=BA=D0=B8/=
=D0=A2=D0=B8=D0=BF=D0=BE=D0=B2=D0=B5_=D0=B4=D1=83=D0=BC=D0=B8/=D0=93=D0=BB=
=D0=B0=D0=B3=D0=BE=D0=BB=D0=B8';
my $encoded_url =3D encode("utf8", $url);

$ua =3D LWP::UserAgent->new;
$ua->parse_head(0);     #### without this line, you get the error twice

# Set up a callback that collect image links
my @links =3D ();
sub callback {
  my($tag, %attr) =3D @_;
  my ($link) =3D values(%attr);
  $link =3D url($link, $encoded_url)->abs;
  $link =3D decode("utf8", uri_unescape($link));
  push(@links, $link);
}

$p =3D HTML::LinkExtor->new(\&callback);

# Request document and parse it as it arrives
$ua->request(HTTP::Request->new(GET =3D> encode("utf8", $url)),
	     sub {$p->parse($_[0])});


# Print them out
print join("\n", @links), "\n";



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

Date: 2 Oct 2006 06:41:28 -0700
From: beartiger@gmail.com
Subject: Re: Modifying a one-liner
Message-Id: <1159796488.284925.140010@b28g2000cwb.googlegroups.com>

Uri Guttman wrote:
> >>>>> "b" == beartiger  <beartiger@gmail.com> writes:
>
>   b> Uri Guttman wrote:
>   >> >>>>> "b" == beartiger  <beartiger@gmail.com> writes:
>
>   b> If it has nothing to do with Perl, what exempts you from posting on
>   b> topic?
>
>
> by virtue of my trying to get you to leave. but you won't. have fun.

A cunning strategy: to get someone you consider a "troll" to leave by
 ... replying over and over and over to him!  You is reeil smaht.

> we
> have outlasted much worse trolls than you. you might as well leave now
> because you will become bored trolling here.

BURRRRRRRP.

> on topic includes managing and isolating trolls. you are not wanted and
> you aren't funny or anything but a troll. live with it. leave.

Did you know your first name may be changed to the word urine by the
addition of a mere two letters?


J



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

Date: Mon, 02 Oct 2006 10:23:02 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Modifying a one-liner
Message-Id: <g698xjyyeyh.fsf@CN1374059D0130.kendall.corp.akamai.com>

On  1 Oct 2006, beartiger@gmail.com wrote:

> Then why do *you* spell it PERL here?
>
> http://cgi2.cs.rpi.edu/~lallip/perl/spring06/index.shtml

You may not know that all-uppercase letters are an acceptable way to
capitalize headings and titles, at least in the USA.

http://en.wikipedia.org/wiki/Capitalization#Headings_and_publication_titles

I hope this answers your question.  Thank you for visiting this
newsgroup on your quest for enlightenment.

Ted


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

Date: 2 Oct 2006 15:04:15 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: My first socket question
Message-Id: <6m12i212s0gcl8n0b8pn2uq60jtecnt3q4@4ax.com>

On 02 Oct 2006 02:33:01 GMT, xhoster@gmail.com wrote:

>>   while (1) {
>>       $cnt++;
>>       $val=rand;  # these are the important calculations!!
>>       next unless $sel->can_read(0.2);
>
>Why the 0.2?  If the main task is $cnt++ and $val=rand, then it should
>be spending most of it's time there and not waiting for someone to make
>a connection that quite likely will not come within any given 0.2 anyway.

No really good reason but utter ignorance. In my ignorance I thought
the call may block if I don't timeout. Indeed can_read()'s
documentation mentions that possibility in connection with
"registered" handles. But I'm not really sure if I know what that
means. No, I'm sure: I *don't* know.

BTW: the "real" application is not that computation intensive, and
actually has a sleep(1) in the main cycle. I get your point, though.
And I thank you for your informative reply.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 2 Oct 2006 07:24:52 -0700
From: "buff3r" <buff3r@gmail.com>
Subject: New Perl Mongers Group (Orlando, FL, USA)
Message-Id: <1159799092.327432.57230@i3g2000cwc.googlegroups.com>

OPUG (Orlando Perl User Group) has been established to serve
the Perl community in the Central Florida area.  Membership is
free and open to everyone.

The groups aims to :

o offer help and troubleshooting to our members through our mailing
lists and regular meetings

o contribute to the open-source community via CPAN through
collaborative projects

o to host an annual conference ( hey we can dream, right? )

We currently have no predetermined meeting schedule but would plan a
meeting based on demand.

http://orlando.pm.org/
http://groups.google.com/group/orlando-perl-mongers?lnk=oa

Thanks.
Andrew - OPUG



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

Date: 2 Oct 2006 00:06:08 -0700
From: usenet@DavidFilmer.com
Subject: Re: newbie syntax question -> and =>
Message-Id: <1159772768.512020.240240@c28g2000cwb.googlegroups.com>

ToddAndMargo@gbis.com wrote:
> Thank you.  I think i almost get it.  "->" and
> "=>" are the same thing but "->" has a
> higher precedence than does "=>".

In the example you gave, "=>" is really like a comma in an array
definition (it's called a 'fat comma').  You invoked the "new" method
(via the "->") of the INET module, and passed it a hash (an anonymous
hash, but a hash) of key/value pairs (using the fat comma syntax).  You
could have constructed the hash another way if you had preferred and
passed that instead.

-- 
David Filmer (http://DavidFilmer.com)



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

Date: Mon, 02 Oct 2006 09:37:25 +0100
From: Henry Law <news@lawshouse.org>
Subject: Re: newbie syntax question -> and =>
Message-Id: <1159778243.73650.0@despina.uk.clara.net>

ToddAndMargo@gbis.com wrote:

> Thank you.  I think i almost get it.  "->" and
> "=>" are the same thing but "->" has a
> higher precedence than does "=>".

I'm not tremendously expert in Perl yet but I have to say I don't think 
this is right.  Quoting from perlop, and adding a bit of explanation for 
you:

> the => operator is a synonym for the comma, but ...

It's particularly used when setting up a hash, like this

   my %outfit = (trousers=>"Blue", shirt=>"White", shoes=>"Brown");

which is the same as

   my %outfit = ("trousers", "Blue", "shirt", "White", "shoes", "Brown");

but easier to type and understand.

Whereas
> "->" is an infix dereference operator, just as it is in C and

I can't relate this to Modula2 and I know it doesn't exist in bash, but 
it's rather like a pointer in C.  If I create a reference to the hash above

	my $ref_to_outfit = \%outfit;

 ... that reference is a bit like a pointer and to get the stuff "at the 
end of it" you need to dereference it.  The -> operator is one way to do 
that (TMTOWTDI, remember).  To print out the colour of the trousers 
you'd code

	print "Trousers are $ref_to_outfit->{trousers}\n";

-- 

Henry Law       <><     Manchester, England


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

Date: 2 Oct 2006 13:45:01 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: newbie syntax question -> and =>
Message-Id: <ppg1i21t1uknll3sbf7k2k4fsrbtavm53a@4ax.com>

On 1 Oct 2006 23:21:05 -0700, ToddAndMargo@gbis.com wrote:

>Thank you.  I think i almost get it.  "->" and
>"=>" are the same thing but "->" has a
>higher precedence than does "=>".

NOT AT ALL! -> is the dereferencer and => is nothing but a comma. Did
you *really* read

  perldoc perlop

as suggested?!?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Mon, 2 Oct 2006 07:14:59 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: newbie syntax question -> and =>
Message-Id: <slrnei20m3.nhu.tadmc@magna.augustmail.com>

ToddAndMargo@gbis.com <ToddAndMargo@gbis.com> wrote:
> usenet@DavidFilmer.com wrote:
>> ToddAndMargo@gbis.com wrote:
>> > Looking over an example, I notices "->" and "=>"
>>
>>    perldoc perlop
>>
>> --
>> David Filmer (http://DavidFilmer.com)


Please do not quote signatures. It is bad netiquette.

Have you seen the Posting Guidelines that are posted here frequently?


> I think i almost get it.  


You are not yet thinking correctly.


> "->" and
> "=>" are the same thing but "->" has a
> higher precedence than does "=>".


You need to read further than just the precedence table.

Otherwise _every_ operator is the same except for precedence!

The -> operator is described in "The Arrow Operator" section of perlop.

The => operator is described in the "Comma Operator" section of perlop.


> I will learn
> Perl if it kills me!


Learning your way around the standard Perl docs will go a
long way towards that.

See also:

   http://learn.perl.org


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 2 Oct 2006 15:02:57 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: newbie syntax question -> and =>
Message-Id: <efr9tb.10g.1@news.isolution.nl>

Michele Dondi schreef:

> => is nothing but a comma

There is a difference: it stringifies its left operand if that operand
is a bareword.

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: 2 Oct 2006 15:13:17 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: newbie syntax question -> and =>
Message-Id: <5142i21b49e0kkgh5jvs7ro6nk0dsikhtp@4ax.com>

On Mon, 02 Oct 2006 09:37:25 +0100, Henry Law <news@lawshouse.org>
wrote:

>   my %outfit = (trousers=>"Blue", shirt=>"White", shoes=>"Brown");
>
>which is the same as
>
>   my %outfit = ("trousers", "Blue", "shirt", "White", "shoes", "Brown");
>
>but easier to type and understand.

Ease to type is in the eye of the beholder, but quite difficulty so.
Certainly easier to understand.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

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 V10 Issue 9789
***************************************


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