[30506] in Perl-Users-Digest
Perl-Users Digest, Issue: 1749 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 28 00:09:44 2008
Date: Sun, 27 Jul 2008 21:09:07 -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, 27 Jul 2008 Volume: 11 Number: 1749
Today's topics:
Re: 5% paypal handling charge supports the online payme <bill@ts1000.us>
Re: 5% paypal handling charge supports the online payme <bill@ts1000.us>
Re: dynamic scoped variables in the debugger xhoster@gmail.com
Re: dynamic scoped variables in the debugger <user@serverrb.net>
Parse::RecDescent problem regarding rule matching <rui.maciel@gmail.com>
problem with charset <rtfm.rtfm.rtfm@gmail.com>
Re: problem with charset <noreply@gunnar.cc>
strange behavior of ?? <user@serverrb.net>
Re: strange behavior of ?? (Zak B. Elep)
Textfile to array or hash <juergen.gluch@gmx.de>
Re: Textfile to array or hash (Jens Thoms Toerring)
Re: Textfile to array or hash <jurgenex@hotmail.com>
Re: Textfile to array or hash <bill@ts1000.us>
Re: Textfile to array or hash (Jens Thoms Toerring)
Re: Textfile to array or hash <jurgenex@hotmail.com>
Re: Textfile to array or hash <bill@ts1000.us>
Which NNTP module to use? <no@spam.com>
Re: Why stdin lose after new Thread xhoster@gmail.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 27 Jul 2008 11:18:50 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Re: 5% paypal handling charge supports the online payment! PayPal
Message-Id: <2fe8b178-45e7-4a80-95a0-cdf9329a929f@59g2000hsb.googlegroups.com>
On Jul 27, 12:49=A0pm, yuwenwu...@gmail.com wrote:
> 5% paypal handling charge supports the online payment! PayPal
> cheap =A0Guess wallet
> Dear friend
> welcome to shopping onwww.Shoes-paypal.cn
> 1.5% paypal handling charge supports the online payment!
> 2.Use your intergla replacement more good gift!
> 3.notes by email and website of deliver each package at first time.
I have always wondered are these chinese to english translations
direct word for word and is the chinese language this "messed up"?
Bill H
------------------------------
Date: Sun, 27 Jul 2008 11:20:05 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Re: 5% paypal handling charge supports the online payment! PayPal
Message-Id: <4c95d5a8-2b5b-45a4-8a53-6500d1091ef8@79g2000hsk.googlegroups.com>
On Jul 27, 12:49=A0pm, yuwenwu...@gmail.com wrote:
> 5% paypal handling charge supports the online payment! PayPal
> cheap =A0Guess wallet
> Dear friend
> welcome to shopping onwww.Shoes-paypal.cn
> 1.5% paypal handling charge supports the online payment!
> 2.Use your intergla replacement more good gift!
> 3.notes by email and website of deliver each package at first time.
Oh I forgot:
4. strong is the return on payment this one is Obiwan
Bill H
------------------------------
Date: 28 Jul 2008 00:47:08 GMT
From: xhoster@gmail.com
Subject: Re: dynamic scoped variables in the debugger
Message-Id: <20080727204711.629$KW@newsreader.com>
Nathan <user@serverrb.net> wrote:
> Hi,
>
> I'm running Perl v5.8.8 compiled for linux. I was reading about the perl
> debugger and ran the following script with the command "perl -d":
>
> 1 #!/ usr/bin/perl
> 2 $_ = "foo";
> 3 /foo/;
> 4
> 5 print "$&";
> 6 print "\n";
>
> As expected it prints "foo" before the newline, and if I check the value
> of $& in the debugger it does show "foo". However, if I omit line 5 of
> the program then the debugger says $& is undefined when it reaches the
> last print statement.
When the program is compiled, if the compiler sees $& being used,
then it tuns on the (expensive) code which causes $& to be set during
regex operations. If $& is not seen, then this code is not activated
and $& does not get populated.
> I don't understand how this can be, is there some
> subtlety to the way the debugger treats dynamically scoped variables?
This is not related to the debugger itself. The debugger is just giving
you a way arrange things so that you can inspect $& without perl knowing
you are going to do so. You can get the same behaviour using string eval:
perl -le '$_="foo"; /foo/; eval q{print "$&"}'
Also, $& is not just a dynamic variable (like $foo::bar), but a special
variable. It is the implementation details of this specialness that is
tripping you up.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Sun, 27 Jul 2008 21:32:55 -0500
From: Nathan <user@serverrb.net>
Subject: Re: dynamic scoped variables in the debugger
Message-Id: <hbajk.8629$vn7.7339@flpi147.ffdc.sbc.com>
xhoster@gmail.com wrote:
> Nathan <user@serverrb.net> wrote:
>> Hi,
>>
>> I'm running Perl v5.8.8 compiled for linux. I was reading about the perl
>> debugger and ran the following script with the command "perl -d":
>>
>> 1 #!/ usr/bin/perl
>> 2 $_ = "foo";
>> 3 /foo/;
>> 4
>> 5 print "$&";
>> 6 print "\n";
>>
>> As expected it prints "foo" before the newline, and if I check the value
>> of $& in the debugger it does show "foo". However, if I omit line 5 of
>> the program then the debugger says $& is undefined when it reaches the
>> last print statement.
>
> When the program is compiled, if the compiler sees $& being used,
> then it tuns on the (expensive) code which causes $& to be set during
> regex operations. If $& is not seen, then this code is not activated
> and $& does not get populated.
>
>> I don't understand how this can be, is there some
>> subtlety to the way the debugger treats dynamically scoped variables?
>
> This is not related to the debugger itself. The debugger is just giving
> you a way arrange things so that you can inspect $& without perl knowing
> you are going to do so. You can get the same behaviour using string eval:
>
> perl -le '$_="foo"; /foo/; eval q{print "$&"}'
>
> Also, $& is not just a dynamic variable (like $foo::bar), but a special
> variable. It is the implementation details of this specialness that is
> tripping you up.
>
> Xho
>
Thanks Xho, I vaguely suspected something along those lines, but I guess
I underestimated how "special" the special variables are. Perl gives you
everything you need except consistency. :)
-Nathan
------------------------------
Date: 27 Jul 2008 17:34:31 GMT
From: Rui Maciel <rui.maciel@gmail.com>
Subject: Parse::RecDescent problem regarding rule matching
Message-Id: <488cb1a7$0$2621$a729d347@news.telepac.pt>
I'm a Perl newbie and I've started to look into the Parse::RecDescent
module. Meanwhile I've stumbled on a rule matching problem. I've defined
a couple of rules to be able to deal with two different types of numbers:
integers and decimal fractions with a single decimal place. The problem
is that RecDescent returns false positives by matching the integer rule
on decimal fraction numbers.
As far as I can tell, that could only happen if somehow RecDescent
doesn't make any use of any terminal symbol to specify if the rule really
matches a pattern, which I believe could lead to a lot of false positives.
So, am I missing something or is there no solution to this problem?
Some test code follows and thanks in advance
Rui Maciel
#! /usr/bin/perl -w
use strict;
use Parse::RecDescent;
use Encode;
my $text;
my $grammar = <<'EOG';
startrule: grade1 grade2
{ print "$item[1]\t$item[2]\n";
}
grade1: /\d{1,2}\.\d/
grade2: (/\d{1,2}/|"NA")
EOG
my $parser = new Parse::RecDescent($grammar) or die "Bad grammar!\n";
open(FILE, '-') or die "CRAP ON A STICK!";
while($text = <FILE>)
{
chomp($text);
defined $parser->startrule($text) or print "$text\t<------\n";
}
------------------------------
Date: Sun, 27 Jul 2008 13:54:26 +0400
From: Daneel Yaitskov <rtfm.rtfm.rtfm@gmail.com>
Subject: problem with charset
Message-Id: <g6hgnf$k65$1@aioe.org>
Hi,
I started to learn CGI and wrote his first script. I have a problem with
charset of webpage. Referenceing to man help I wrote following code:
#!/usr/bin/perl -w
use utf8;
use encoding 'utf8';
use CGI qw(:standard);
print header(-type=>'text/html', -charset=>'UTF-8');
print start_html('Simple example'),
h1('Simple example'), end_html();
The problem is that a browser gets the generated webpage with a wrong
charset. What do I make wrong?
header of webpage is:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Remote terminal</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
.....
I have sent this letter here, because my letters don't come to
perl.beginners.cgi. Does anyone know why so?
Daneel
------------------------------
Date: Sun, 27 Jul 2008 14:17:45 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: problem with charset
Message-Id: <6f37bhF9a2o1U1@mid.individual.net>
Daneel Yaitskov wrote:
> I started to learn CGI and wrote his first script. I have a problem with
> charset of webpage. Referenceing to man help I wrote following code:
> #!/usr/bin/perl -w
> use utf8;
> use encoding 'utf8';
> use CGI qw(:standard);
>
> print header(-type=>'text/html', -charset=>'UTF-8');
> print start_html('Simple example'),
> h1('Simple example'), end_html();
>
> The problem is that a browser gets the generated webpage with a wrong
> charset. What do I make wrong?
>
> header of webpage is:
> <!DOCTYPE html
> PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
> <head>
> <title>Remote terminal</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> </head>
I'm not able to reproduce that behavior. However, the meta charset can
be set explicitly with the -encoding argument.
print start_html(
-title => 'Simple example',
-encoding => 'utf8',
), ...
> I have sent this letter here, because my letters don't come to
> perl.beginners.cgi. Does anyone know why so?
Have you subscribed to the beginners-cgi list?
http://lists.cpan.org/showlist.cgi?name=beginners-cgi
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 27 Jul 2008 22:06:49 -0500
From: Nathan <user@serverrb.net>
Subject: strange behavior of ??
Message-Id: <4Hajk.8635$vn7.928@flpi147.ffdc.sbc.com>
Hi,
The definition of the m?? operator says that it only matches once
between calls to reset. When I ran the following program I confirmed
this behavior:
#!/usr/bin/perl
$_ = "Bilbo Baggins";
for($i=0;$i<5;$i++) {
$a = ?Bilbo?;
}
That is, $a was set to 1 initially and then '' on every pass through the
loop afterward. However, $a does not seem to be set to 1 at all in this
program:
#!/usr/bin/perl
$_ = "Bilbo Baggins";
for (0..4) {
$a = ?Bilbo?;
}
Initially $a is not defined and then it stays '' on each loop pass. I am
running perl v5.8.8 on linux. My understanding is these two programs are
supposed to be equivalent, so why am I observing different behavior with
the debugger in the second one?
-Nathan
------------------------------
Date: Mon, 28 Jul 2008 11:21:39 +0800
From: zakame@zakame.net (Zak B. Elep)
Subject: Re: strange behavior of ??
Message-Id: <m2iquq4rss.fsf@zakame.net>
Nathan <user@serverrb.net> writes:
> #!/usr/bin/perl
> $_ = "Bilbo Baggins";
> for (0..4) {
> $a = ?Bilbo?;
> }
>
> Initially $a is not defined and then it stays '' on each loop pass. I am
> running perl v5.8.8 on linux. My understanding is these two programs are
> supposed to be equivalent, so why am I observing different behavior with
> the debugger in the second one?
It is because you're aliasing the $_ to the elements of 0..4 in the
for() loop, which not what you expect when you assigned a string to it.
You should then use another scalar in the for() to alias the elements
to, for instance:
,----
| $_ = "Bilbo Baggins";
| for my $count ( 0 .. 4 ) {
| $a = ?Bilbo?;
| print "At $count, \$a is $a\n";
| }
`----
--
I like the idea of 256 bits, though: 32 for the (Unicode) character leaves
room for 224 Bucky bits, which ought to be enough for anyone.
-- Roland Hutchinson, in alt.folklore.computers
------------------------------
Date: Sun, 27 Jul 2008 05:20:58 -0700 (PDT)
From: "J.Gluch" <juergen.gluch@gmx.de>
Subject: Textfile to array or hash
Message-Id: <82195407-8fdb-4361-a44d-2f0d0f55915d@z66g2000hsc.googlegroups.com>
Hello,
I want to extract data from a text file I recieve from the internet to
an array or hash. So far I did not found a solution via google and co
- maybe of my bad english and wrong search term.
The file is put into a varaible :
---------------------
$simartistsAS = `wget -q -O - "http://ws.audioscrobbler.com/1.0/artist/
$m/similar.txt"`;
---------------------
and looks like this:
---------------------
100,,Medeski, Martin and Wood
69.54,e0953daa-860f-4dc8-9f1a-b12587cdaf17,Tortoise
49.98,9de8f66e-3cd1-4f11-8328-38200f0612b0,Doves
45.19,b7834ebd-64ae-46c3-a930-2d3a52ee743a,The Walkmen
43.93,ad386705-fb8c-40ec-94d7-e690e079e979,Menomena
36,9dcca4a2-2e05-4f94-9a02-cb97b1beed56,Kenna
30.97,9ef1d76d-5f1d-4398-b4ed-05afb3172f26,Earlimart
30.25,db41efe6-867b-4427-820c-506ea17e5692,The Anniversary
29.69,309c62ba-7a22-4277-9f67-4a162526d18a,Beck
28.11,cbfd7f01-87c3-44bf-a3a2-fe4dbff20ad2,John Scofield
27.88,bd837f10-ed18-47e9-9636-ca44edceebfd,Elefant
---------------------
I want to have either an array or hash that contains all artist names
(the string after the second comma, that have rating higher than 50
(the first number until first coma).
For this task I do not want to use any aditional modules. How do
process the data?
Juergen Gluch
------------------------------
Date: 27 Jul 2008 13:01:20 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: Textfile to array or hash
Message-Id: <6f39t0F9luggU1@mid.uni-berlin.de>
J.Gluch <juergen.gluch@gmx.de> wrote:
> I want to extract data from a text file I recieve from the internet to
> an array or hash. So far I did not found a solution via google and co
> - maybe of my bad english and wrong search term.
> The file is put into a varaible :
> ---------------------
> $simartistsAS = `wget -q -O - "http://ws.audioscrobbler.com/1.0/artist/
> $m/similar.txt"`;
> ---------------------
> and looks like this:
> ---------------------
> 100,,Medeski, Martin and Wood
> 69.54,e0953daa-860f-4dc8-9f1a-b12587cdaf17,Tortoise
> 49.98,9de8f66e-3cd1-4f11-8328-38200f0612b0,Doves
> 45.19,b7834ebd-64ae-46c3-a930-2d3a52ee743a,The Walkmen
> 43.93,ad386705-fb8c-40ec-94d7-e690e079e979,Menomena
> 36,9dcca4a2-2e05-4f94-9a02-cb97b1beed56,Kenna
> 30.97,9ef1d76d-5f1d-4398-b4ed-05afb3172f26,Earlimart
> 30.25,db41efe6-867b-4427-820c-506ea17e5692,The Anniversary
> 29.69,309c62ba-7a22-4277-9f67-4a162526d18a,Beck
> 28.11,cbfd7f01-87c3-44bf-a3a2-fe4dbff20ad2,John Scofield
> 27.88,bd837f10-ed18-47e9-9636-ca44edceebfd,Elefant
> ---------------------
> I want to have either an array or hash that contains all artist names
> (the string after the second comma, that have rating higher than 50
> (the first number until first coma).
> For this task I do not want to use any aditional modules. How do
> process the data?
As usual, there are lots of ways to skin the cat. This one is
hopefully easy to understand:
my @artists;
for my $line ( split /\n/, $similarArtistsAS ) {
my @data = split /,/, $line;
push @artists, $data[ 2 ] if $data[ 0 ] > 50;
}
The loop runs over all lines (splitting the content of '$similarArtistsAS'
up on the end-of-line character). Each line itself gets split up on the
commas. You push the third element of the result (the stuff after the
second comma) on the array if the first element of the result is larger
than 50.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Sun, 27 Jul 2008 16:06:06 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Textfile to array or hash
Message-Id: <627p8457f3hkgqumn6mopm2pf8g1o0ac13@4ax.com>
"J.Gluch" <juergen.gluch@gmx.de> wrote:
>I want to extract data from a text file I recieve from the internet to
>an array or hash. So far I did not found a solution via google and co
[...]
>28.11,cbfd7f01-87c3-44bf-a3a2-fe4dbff20ad2,John Scofield
>27.88,bd837f10-ed18-47e9-9636-ca44edceebfd,Elefant
>---------------------
>I want to have either an array or hash that contains all artist names
>(the string after the second comma, that have rating higher than 50
>(the first number until first coma).
while() there are still lines to process
split() each line at ','
if the first element is > than 50
then push() the third element onto the result
jue
------------------------------
Date: Sun, 27 Jul 2008 09:25:39 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Re: Textfile to array or hash
Message-Id: <6aa43341-40bd-495d-b07f-0df7120bb93a@m36g2000hse.googlegroups.com>
On Jul 27, 9:01=A0am, j...@toerring.de (Jens Thoms Toerring) wrote:
> J.Gluch <juergen.gl...@gmx.de> wrote:
> > I want to extract data from a text file I recieve from the internet to
> > an array or hash. So far I did not found a solution via google and co
> > - maybe of my bad english and wrong search term.
> > The file is put into a varaible :
> > ---------------------
> > $simartistsAS =3D `wget -q -O - "http://ws.audioscrobbler.com/1.0/artis=
t/
> > $m/similar.txt"`;
> > ---------------------
> > and looks like this:
> > ---------------------
> > 100,,Medeski, Martin and Wood
> > 69.54,e0953daa-860f-4dc8-9f1a-b12587cdaf17,Tortoise
> > 49.98,9de8f66e-3cd1-4f11-8328-38200f0612b0,Doves
> > 45.19,b7834ebd-64ae-46c3-a930-2d3a52ee743a,The Walkmen
> > 43.93,ad386705-fb8c-40ec-94d7-e690e079e979,Menomena
> > 36,9dcca4a2-2e05-4f94-9a02-cb97b1beed56,Kenna
> > 30.97,9ef1d76d-5f1d-4398-b4ed-05afb3172f26,Earlimart
> > 30.25,db41efe6-867b-4427-820c-506ea17e5692,The Anniversary
> > 29.69,309c62ba-7a22-4277-9f67-4a162526d18a,Beck
> > 28.11,cbfd7f01-87c3-44bf-a3a2-fe4dbff20ad2,John Scofield
> > 27.88,bd837f10-ed18-47e9-9636-ca44edceebfd,Elefant
> > ---------------------
> > I want to have either an array or hash that contains all artist names
> > (the string after the second comma, that have rating higher than 50
> > (the first number until first coma).
> > For this task I do not want to use any aditional =A0modules. How do
> > process the data?
>
> As usual, there are lots of ways to skin the cat. This one is
> hopefully easy to understand:
>
> my @artists;
> for my $line ( split /\n/, $similarArtistsAS ) {
> =A0 =A0 my @data =3D split /,/, $line;
> =A0 =A0 push @artists, $data[ 2 ] if $data[ 0 ] > 50;
>
> }
>
> The loop runs over all lines (splitting the content of '$similarArtistsAS=
'
> up on the end-of-line character). Each line itself gets split up on the
> commas. You push the third element of the result (the stuff after the
> second comma) on the array if the first element of the result is larger
> than 50.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Regards, Jens
> --
> =A0 \ =A0 Jens Thoms Toerring =A0___ =A0 =A0 =A0j...@toerring.de
> =A0 =A0\__________________________ =A0 =A0 =A0http://toerring.de- Hide qu=
oted text -
>
> - Show quoted text -
I havent used push before, does it perform the same exact function as
using "=3D"? So in you sexample:
push @artists, $data[ 2 ] if $data[ 0 ] > 50;
Would this be the exact equivalent of doing:
if ($data[0] > 50){$artists[@artists] =3D $data[2];}
Or does more happen with push? Just for the record the last time I
ever used a "push" command was in Z80 ML programming on a Timex
Sinclair 1000 (bout 3 years ago).
Bill H
------------------------------
Date: 27 Jul 2008 17:29:01 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: Textfile to array or hash
Message-Id: <6f3pitF9fr17U1@mid.uni-berlin.de>
Bill H <bill@ts1000.us> wrote:
> I havent used push before, does it perform the same exact function as
> using "="? So in you sexample:
> push @artists, $data[ 2 ] if $data[ 0 ] > 50;
> Would this be the exact equivalent of doing:
> if ($data[0] > 50){$artists[@artists] = $data[2];}
Yes, here it does. It simply appends '$data[2]' to the end of
the '@artists' array. And it does it more efficiently (at
least that's what the documentation claims).
> Or does more happen with push?
Well, you can also 'push' a whole list, thus appending a number
of new elements to the array. So you can e.g. do
my @a = ( 1, 2, 3 );
my @b = ( 4, 5, 6 );
push @a, @b;
to concatenate @a and @b. And it returns the new number of
elements of the array.
> Just for the record the last time I
> ever used a "push" command was in Z80 ML programming on a Timex
> Sinclair 1000 (bout 3 years ago).
It's a bit similar as far as I remember (but it's nearly 20
years since I last used a Z80). There the PUSH command moved
the content of a register onto the stack, automatically de-
crementing the stack pointer by two (and POP moved data back
from the stack into a register and incremented SP twice).
Perl's push() and pop() functions allow you to use each array
as a kind of stack.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Sun, 27 Jul 2008 17:49:31 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Textfile to array or hash
Message-Id: <avcp84hpuulofc8bb8ppofn4rud0i9mled@4ax.com>
Bill H <bill@ts1000.us> wrote:
>I havent used push before, does it perform the same exact function as
>using "="?
Why don't you simply check the documentation that came with your Perl
installation?
perldoc -f push
To answer your direct question: No.
"=" can be used to assign to any variable, push() is limited to arrays.
>So in you sexample:
>
>push @artists, $data[ 2 ] if $data[ 0 ] > 50;
>
>Would this be the exact equivalent of doing:
>
>if ($data[0] > 50){$artists[@artists] = $data[2];}
Yes, except for the return value of this construct.
>Or does more happen with push? Just for the record the last time I
Yes, ist also sets the return value to the new number of elements in the
array. This is explained in the documentation.
jue
------------------------------
Date: Sun, 27 Jul 2008 11:10:01 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Re: Textfile to array or hash
Message-Id: <6b764377-e938-4355-8df0-dec63ee08da6@59g2000hsb.googlegroups.com>
On Jul 27, 1:49=A0pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> Bill H <b...@ts1000.us> wrote:
> >I havent used push before, does it perform the same exact function as
> >using "=3D"?
>
> Why don't you simply check the documentation that came with your Perl
> installation?
> =A0 =A0 =A0 =A0 perldoc -f push
>
> To answer your direct question: No.
> "=3D" can be used to assign to any variable, push() is limited to arrays.
>
> >So in you sexample:
>
> >push @artists, $data[ 2 ] if $data[ 0 ] > 50;
>
> >Would this be the exact equivalent of doing:
>
> >if ($data[0] > 50){$artists[@artists] =3D $data[2];}
>
> Yes, except for the return value of this construct.
>
> >Or does more happen with push? Just for the record the last time I
>
> Yes, ist also sets the return value to the new number of elements in the
> array. This is explained in the documentation.
>
> jue
I'm going to do that Jurgen. Every now and then I see a command used
on here that I haven't used before and I add it to my daily usage. The
push seems like a nifty one.
Bill H
------------------------------
Date: Sun, 27 Jul 2008 23:30:06 -0400
From: nospam <no@spam.com>
Subject: Which NNTP module to use?
Message-Id: <u8udndILceijoBDVnZ2dnUVZ_uLinZ2d@comcast.com>
Is there a defacto standard for NNTP perl modules? Some time ago I used
News::NNTPClient, and I've just installed News::NNTP. Is there a
preferred NNTP module I should be using?
-Thanks
------------------------------
Date: 28 Jul 2008 01:11:15 GMT
From: xhoster@gmail.com
Subject: Re: Why stdin lose after new Thread
Message-Id: <20080727211118.564$1S@newsreader.com>
haomiao <miaohaoz@ustc.edu> wrote:
> Hi
>
> When I create a new thread, the main thread cannot get input from
> <>.
>
> The code is like
> -----------------------------------------------
> while ( $line = <STDIN> ) {
> chomp $line;
> execCmdLine($line);
> print "pp> ";
> }
> ------------------------------------------------
> In the execCmdLine function, if $line eq 'conn', a new thread is
> created. Then
> the main thread can not get any line at all.
>
> How can I let the main thread continue?
Show us the contents execCmdLine, suitably reduced such that it does
as little as possible but still exhibits the relevant behavior.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
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 1749
***************************************