[25427] in Perl-Users-Digest
Perl-Users Digest, Issue: 7672 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 19 11:05:49 2005
Date: Wed, 19 Jan 2005 08:05:16 -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 Wed, 19 Jan 2005 Volume: 10 Number: 7672
Today's topics:
Re: creating socket on specific IP address <ThomasKratz@REMOVEwebCAPS.de>
Re: creating socket on specific IP address <nobull@mail.com>
Re: creating socket on specific IP address <ThomasKratz@REMOVEwebCAPS.de>
Re: Directory listing <richard@zync.co.uk>
Re: FAQ 4.64 How can I get the unique keys from two has (Anno Siegel)
Re: FAQ 5.11 How can I output my numbers with commas ad <hendrik_maryns@despammed.com>
Re: Help Perlling a program <nobull@mail.com>
Re: Help Perlling a program <matthew.garrish@sympatico.ca>
Re: How to compare files? <bik.mido@tiscalinet.it>
Re: MAP Question <bik.mido@tiscalinet.it>
Re: MAP Question <bik.mido@tiscalinet.it>
Re: Need help with Perl and MySQL database data load <oscar@nowhere.com>
Re: Parsing in regular expression <tadmc@augustmail.com>
Perl and waiting for execution of external program jonas.andersson@rocketmail.com
Re: Perl and waiting for execution of external program <noreply@gunnar.cc>
Re: Perl and waiting for execution of external program jonas.andersson@rocketmail.com
Re: Perl and waiting for execution of external program <matternc@comcast.net>
Re: Perl6 book <bik.mido@tiscalinet.it>
Re: Perl6 book (Anno Siegel)
Re: Perl6 book <jkeen_via_google@yahoo.com>
Re: The world's shortest 'Hello World!' program: a prop <bik.mido@tiscalinet.it>
Re: The world's shortest 'Hello World!' program: a prop <perl@lennychallis.co.uk>
Re: Why doesn't this work? <tadmc@augustmail.com>
Re: Why doesn't this work? (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 19 Jan 2005 14:23:28 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: creating socket on specific IP address
Message-Id: <41ee5f50$0$816$bb690d87@news.main-rheiner.de>
Al the Pal wrote:
> Thanks for the reply, but I wan't clear when I asked the question.
>
> Although this is located on a server, I am asking about a client
> connection. The server has several IP addresses, but when I make an
> outgoing connection, I want to choose the IP that I make the connection
> on. I see nothing in the socket command that let's me choose which IP
> the socket connects to locally.
>
Reading this and seeing your code snippet in the original post, I assume
you have a misconception of what opening a client connection over TCP does.
You can specify an destination IP address and a port. Nothing more. How
your system does this is beyond the control of your script.
What network interface is used for the connection is determined by the
routing information the IP stack is working with. You should be able to
have a look at the routing table with a 'netstat -r' (should work on
Unixes and Win32)
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
------------------------------
Date: Wed, 19 Jan 2005 13:43:51 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: creating socket on specific IP address
Message-Id: <cslntk$g1m$1@sun3.bham.ac.uk>
Thomas Kratz wrote:
> [...] I assume
> you have a misconception of what opening a client connection over TCP does.
> You can specify an destination IP address and a port. Nothing more. How
> your system does this is beyond the control of your script.
No, it would appear that you have the misconception.
When you open a TCP connection you can specify the source address and
port too if you want to. Of course you can only choose an IP address
that belongs to the box you are on.
> What network interface is used for the connection is determined by the
> routing information the IP stack is working with.
This is true. And the _default_ source IP address will usually be the
primary one assigned to the chosen interface. Although if you've got a
really rich IP stack semantic as say in Linux you can make the default
source address dependant on many factors. For example I have in the
past decided on one box that I want all TCP connections outbound to port
25 to default to a different source IP address.
None of this, of course, is related to Perl.
------------------------------
Date: Wed, 19 Jan 2005 15:38:17 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: creating socket on specific IP address
Message-Id: <41ee70da$0$781$bb690d87@news.main-rheiner.de>
Brian McCauley wrote:
>
>
> Thomas Kratz wrote:
>
>> [...] I
>> assume you have a misconception of what opening a client connection
>> over TCP does.
>> You can specify an destination IP address and a port. Nothing more.
>> How your system does this is beyond the control of your script.
>
>
> No, it would appear that you have the misconception.
>
> When you open a TCP connection you can specify the source address and
> port too if you want to. Of course you can only choose an IP address
> that belongs to the box you are on.
You're right. I should have known better.
Wether you can reach the destination via the interface the address is
bound to, is another thing.
>
>> What network interface is used for the connection is determined by the
>> routing information the IP stack is working with.
>
>
> This is true. And the _default_ source IP address will usually be the
> primary one assigned to the chosen interface. Although if you've got a
> really rich IP stack semantic as say in Linux you can make the default
> source address dependant on many factors. For example I have in the
> past decided on one box that I want all TCP connections outbound to port
> 25 to default to a different source IP address.
>
> None of this, of course, is related to Perl.
Of course, so EOT.
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
------------------------------
Date: Wed, 19 Jan 2005 12:34:26 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: Directory listing
Message-Id: <pan.2005.01.19.12.34.26.63051@zync.co.uk>
On Tue, 18 Jan 2005 17:59:23 -0800, Crom wrote:
> Abigail wrote:
>> Frank Raz (rv01@gre.ac.uk) wrote on MMMMCLVIII September MCMXCIII in
>> <URL:news:DhhHd.280$Z31.44@newsfe1-gui.ntli.net>:
>> ## Hi
>> ##
>> ## I am a new comer to the world of PERL scripting.
>>
>> The language is called Perl. The binary is called perl. There's no
>> such thing as PERL.
>
> Please excuse my bluntness, but the sky is NOT falling.
I think you're missing the point. Programming is a precise endeavour. It
is an enormous help if you are in the habit of being precise all the time,
rather than trying to decide what context you are in and whether you can
afford to be sloppy, both in expression and interpretation. That's why the
objection to casing. It's about respecting the input filters (and
therefore *time*) of the people whose help you are asking for.
At least, that's one way of looking at it.
Rich
------------------------------
Date: 19 Jan 2005 13:17:26 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FAQ 4.64 How can I get the unique keys from two hashes?
Message-Id: <cslml6$ff$1@mamenchi.zrz.TU-Berlin.DE>
PerlFAQ Server <comdog@panix.com> wrote in comp.lang.perl.misc:
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with Perl.
>
> --------------------------------------------------------------------
>
> 4.64: How can I get the unique keys from two hashes?
The phrase "unique keys from two hashes" is ambiguous. From the solution...
> First you extract the keys from the hashes into lists, then solve the
> "removing duplicates" problem described above. For example:
>
> %seen = ();
> for $element (keys(%foo), keys(%bar)) {
> $seen{$element}++;
> }
> @uniq = keys %seen;
...it is clear that it meant to mean "the keys from both hashes, each only
once", but it can also be read as "the keys that appear in one hash but not
the other".
[snip]
Anno
------------------------------
Date: Wed, 19 Jan 2005 12:25:06 +0100
From: Hendrik Maryns <hendrik_maryns@despammed.com>
Subject: Re: FAQ 5.11 How can I output my numbers with commas added?
Message-Id: <NPudnb0fpOwN3nPcRVnyuw@scarlet.biz>
PerlFAQ Server schreef:
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with Perl.
>
> --------------------------------------------------------------------
>
> 5.11: How can I output my numbers with commas added?
>
> This subroutine will add commas to your number:
>
> sub commify {
> local $_ = shift;
> 1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
> return $_;
> }
>
> This regex from Benjamin Goldberg will add commas to numbers:
>
> s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g;
>
> It is easier to see with comments:
>
> s/(
> ^[-+]? # beginning of number.
> \d{1,3}? # first digits before first comma
> (?= # followed by, (but not included in the match) :
> (?>(?:\d{3})+) # some positive multiple of three digits.
> (?!\d) # an *exact* multiple, not x * 3 + 1 or whatever.
> )
> | # or:
> \G\d{3} # after the last group, get three digits
> (?=\d) # but they have to have more digits after them.
> )/$1,/xg;
It's funny there are two differences between the regexp in one line and
the commented one... (though I reckon they do the same thing)
(the x and the {1,3} are different)
H.
------------------------------
Date: Wed, 19 Jan 2005 13:23:15 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Help Perlling a program
Message-Id: <cslmm7$fg0$1@sun3.bham.ac.uk>
Matt Garrish wrote:
> "YYusenet" <yyusenet@yahoo.com> wrote in message
> news:cskjbo$js0$1@news.xmission.com...
>
>>Hello,
>>
>>I am new to Perl, so I am probably making my programs (or scripts?) in a
>>non-Perl way. I was wondering if the following script could be made with
>>less repition or lines of code, or in a more Perl like way.
>>
>>The script is used so if I download a lot of pictures with not very useful
>>names (like from digital camera software that exports pictures called
>>IMG000001234 or something), it would name them in order, starting with
>>zero. It also should work assuming that there may already be files named
>>0.jpg, etc.
>>
>
>
> You should bundle repitious code into subroutines whenever possible.
In general this is good advice but it can be taken too far. I think
Matt's one-liner print_line() might be a case of taking it too far. On
the other hand he's left a 6-line section that's repeated.
Also it's not just subroutines that can be used to eliminate repeated
code - you can also do it with loops.
It's all part of the maxim "if you are doing it three times then you are
probably doing it wrong".
> A couple of other points I'd make are to use more whitespace in your code
But don't forget "always write less source unless this would make it
less readable". This applies to whitespace an comments too. Do not
insert them where they don't aid readability. I particular there's
little to be gained by simply double-line-spaceing a whole line of code.
> always name your variables.
Good advice. This also applies to subroutine arguments. Except in very
short subs don't say $_[0], copy it to a named variable. In fact my
favourite rule-of-3 applies here too. If you have three or more
explicit $_[n] in a subroutine then you probably should have used named
variables.
> Readability of your code is far more important than how "perlish" it might be.
But assuming the code is to be read by Perl programmers the perlishness
can be an element of the readability. Given the choice use the more
perlish form unless this would compromise readbility in some other way.
> use strict;
> use warnings;
> use File::Copy;
>
> my $path = 'c:/temp/';
>
> my $files = get_files($path);
>
> print_line("RENAMING .jpg STARTING");
>
> my $cnt = '0';
You should always use the natural representation of things. The
variable $cnt is being used as a numeric counter. The natural
representation of the number zero is the number 0 not the string '0'.
Of course Perl will sitently convert back and forth.
> foreach my $file (@{$files->{'jpg'}}) {
It would probably be more perlish to omit the ''.
> rename_file($file, $path, '.jpg', $cnt);
> $cnt += 1;
More perlish would be
rename_file($file, $path, '.jpg', $cnt++);
> print_line("RENAMING .gif STARTING");
[ and then all the same stuff again ]
OK I said 3. But sometimes even if you are doing it twice you are doing
it wrong.
foreach my $ext ( 'jpg','gif' ) {
print_line("RENAMING .$ext STARTING");
my $cnt = 0;
foreach my $file (@{$files->{$ext}}) {
rename_file($file, $path, ".$ext", $cnt++);
}
print_line("RENAMING COMPLETE");
}
> sub get_files {
>
> my %files;
>
> opendir(FILEDIR, $_[0]) or die "Could not read $_[0]: $!";
You should not use global variables in subroutines.
You should name your variables.
my $dir = shift;
opendir(my $filedir, $dir) or die "Could not read $dir: $!";
------------------------------
Date: Wed, 19 Jan 2005 09:16:39 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Help Perlling a program
Message-Id: <aZtHd.45585$W33.1050992@news20.bellglobal.com>
"Brian McCauley" <nobull@mail.com> wrote in message
news:cslmm7$fg0$1@sun3.bham.ac.uk...
>
>
> Matt Garrish wrote:
>
>> "YYusenet" <yyusenet@yahoo.com> wrote in message
>> news:cskjbo$js0$1@news.xmission.com...
>>
>>>Hello,
>>>
>>>I am new to Perl, so I am probably making my programs (or scripts?) in a
>>>non-Perl way. I was wondering if the following script could be made with
>>>less repition or lines of code, or in a more Perl like way.
>>>
>>>The script is used so if I download a lot of pictures with not very
>>>useful names (like from digital camera software that exports pictures
>>>called IMG000001234 or something), it would name them in order, starting
>>>with zero. It also should work assuming that there may already be files
>>>named 0.jpg, etc.
>>>
>>
>>
>> You should bundle repitious code into subroutines whenever possible.
>
> In general this is good advice but it can be taken too far. I think
> Matt's one-liner print_line() might be a case of taking it too far. On
> the other hand he's left a 6-line section that's repeated.
>
I got sick of seeing all the dashes interspersed in the code, and since
every comment is being output exactly the same way, I just wanted to reduce
noise (you're free to be of another opinion, though). And you're right that
it could use another subroutine to bundle the foreach loops. I was getting
lazy at that point... : )
Matt
------------------------------
Date: Wed, 19 Jan 2005 15:03:25 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to compare files?
Message-Id: <ksnsu0h8aje6nvcinlg5s8ut1efq9mr8ml@4ax.com>
On Tue, 18 Jan 2005 09:06:08 +0100, Josef Moellers
<josef.moellers@fujitsu-siemens.com> wrote:
>> If with "if they match" you mean "if they are _exactly_ the same",
>> then I'd just take a cheksum (e.g. MD5) of both and compare them.
>
>Since an MD5 checksum is often shorter than the file it is taken of (it
>would be pointless to use if it weren't), the statement "two files are
>exactly the same iff the MD5 checksums are equal" is wrong. After all,
You're perfectly right. Re-reading what I wrote I realize that it
seems to suggest that equality of MD5 sums is a necessary condition
for equality of files, which indeed is _not_ the case[*]. I apologize
to the OP for the inexactness of my claim.
I meant (and still mean), and should have written qq|If with "if they
match" you mean "if they are _exactly_ the same" _and_ it's enough for
you to be _fairly confident_ (as opposed to "absolutely certain") that
they are the same then...|.
I stressed the "_exactly_ the same" point because the OP talked about
"match", which may have meant something different, for example (and
just to make an example), if he was referring to XML files (yes, I
know that this is doubtful) and with "match" he meant "containing the
same data".
[*] As, "simply", _difference_ of the sums is a necessary condition
for the _difference_ of the files.
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: Wed, 19 Jan 2005 15:03:15 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: MAP Question
Message-Id: <s9nsu05gvaohd5bhvo82ci8gl7kre3u8ha@4ax.com>
On Tue, 18 Jan 2005 13:05:07 GMT, "George" <georgekinley@hotmail.com>
wrote:
>Here I did not understood the map properly so I thought that $_ has to
>be needs to be defined inside the block/EXPR for regex to perform
Not intended to be a personal offence, but... quite an interesting
"syntax"! ;-)
WRT your original post, $_ _is_ defined inside the block, _implicitly_
(which is the good point about it, BTW).
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: Wed, 19 Jan 2005 15:03:20 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: MAP Question
Message-Id: <bensu01ldf7ign179ek2p4rua5s4c6f105@4ax.com>
On Tue, 18 Jan 2005 08:34:43 GMT, "George" <georgekinley@hotmail.com>
wrote:
>Michele Dondi wrote:
[snip 51 more lines]
Please trim the quoted content down to the bare necessary minimum, so
that it's undoubtedly clear what you will be referring to.
>writing map as MAP was just for eye catcher, like in BOLD, I never
>thought you guys would even comment on that,
Well, there's hardly any need for an "eye catcher", especially if
applied not to a generic word, but to a keyword of a case sensitive
language. If you want to visually mark out a (builtin) function, and
indeed you may have good reasons to do so, but still want to talk Perl
you can either write e.g. map() or pod-ish C<map>. The latter applies
to any construct, not only functions, of course.
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: Wed, 19 Jan 2005 13:43:29 GMT
From: Oscar <oscar@nowhere.com>
Subject: Re: Need help with Perl and MySQL database data load
Message-Id: <5utHd.34547$Ta2.3918@fe2.texas.rr.com>
Tore Aursand wrote:
> Oscar wrote:
>
>>> Hmm. Have you upgraded from an older MySQL version that uses another
>>> authentication protocol? Log in to the MySQL shell and try the
>>> following;
>>>
>>> SET PASSWORD FOR 'username'@'host' = OLD_PASSWORD('password');
>
>
>> I did not upgrade. The version I have is one I first installed and my
>> password has never changed.
>
>
> What happened when you tried the above? Have you tried searching Google
> for the same error message?
>
>
That did the trick! I tried several iterations of the SET PASSWORD
command similar to what you displayed. My last attempt seemed to work
as I was then able to connect through the Perl script.
It's strange that using the older password scheme had to be used since
my MySQL version was a new installation and a recent version.
Thanks for your help.
Oscar
------------------------------
Date: Wed, 19 Jan 2005 07:34:37 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Parsing in regular expression
Message-Id: <slrncusofd.5kj.tadmc@magna.augustmail.com>
sam <sam.wun@authtec.com> wrote:
> The following pattern does not return all the values, the pattern only
> able to parse the first two fields:
>
> my $test = "01-, Revlon, n/a, Revlon";
> What should be the correct implementation of this pattern?
my @fields = split /,\s*/, $test;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 19 Jan 2005 07:14:38 -0800
From: jonas.andersson@rocketmail.com
Subject: Perl and waiting for execution of external program
Message-Id: <1106147678.430893.55420@z14g2000cwz.googlegroups.com>
Hi,
Sometimes, when running an external program through Perl, I run into
problems:
...
open (PROG, "|$MyProgram &> /dev/null") or die "cannot open
program"
print PROG "Load file $FileName\n";
print PROG "Calculate all\n";
close (PROG) or die "cannot close program";
...
It sometimes happens that Perl does not wait for the (lengthy)
calculations to finish, but tries to close the program prematurely. (At
least, that is what the symptoms look like).
Is there a way to force Perl to wait for the program to finish before
it tries to close it, however long it takes?
Thanks for your time,
JA
------------------------------
Date: Wed, 19 Jan 2005 16:13:46 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl and waiting for execution of external program
Message-Id: <357cmdF4idj5nU1@individual.net>
jonas.andersson@rocketmail.com wrote:
> It sometimes happens that Perl does not wait for the (lengthy)
> calculations to finish, but tries to close the program prematurely. (At
> least, that is what the symptoms look like).
How is the program invoked? Is it possibly run as a CGI script?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 19 Jan 2005 07:34:56 -0800
From: jonas.andersson@rocketmail.com
Subject: Re: Perl and waiting for execution of external program
Message-Id: <1106148896.336776.250870@c13g2000cwb.googlegroups.com>
>How is the program invoked? Is it possibly run as a CGI script?
You are correct: it is run as a CGI script. Sorry for not mentioning
that.
/ JA
------------------------------
Date: Wed, 19 Jan 2005 10:59:19 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Perl and waiting for execution of external program
Message-Id: <WcSdnTMAl_tKHnPcRVn-vA@comcast.com>
jonas.andersson@rocketmail.com wrote:
> Hi,
>
> Sometimes, when running an external program through Perl, I run into
> problems:
>
> ...
> open (PROG, "|$MyProgram &> /dev/null") or die "cannot open
> program"
>
> print PROG "Load file $FileName\n";
> print PROG "Calculate all\n";
>
> close (PROG) or die "cannot close program";
> ...
>
> It sometimes happens that Perl does not wait for the (lengthy)
> calculations to finish, but tries to close the program prematurely. (At
> least, that is what the symptoms look like).
>
What the symptoms actually *are* would be more useful in solving
the problem then your interpretation of what they "look like."
You should be providing the first instead of the second, rather
than the other way around.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Wed, 19 Jan 2005 15:03:29 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl6 book
Message-Id: <8mpsu05ko0m46s75gdmqd5oet2218ipa13@4ax.com>
On 18 Jan 2005 11:04:23 -0800, ioneabu@yahoo.com wrote:
>On Amazon there are two O'Reilly Perl 6 books.
[snip]
>I am thinking of getting the 2nd one for $2.82 just to have a look. Is
>the Perl 6 info already wrong and outdated from one book to the other?
>Do I really need to know all about Parrot right away?
I read at a bookstore a large part of "Perl6 Essentials". I don't
remember which edition it was, not that I care, and I doubt it
matters: after staying for some time in p6l I realized it was obsolete
the very moment trees were cut or even before...
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: 19 Jan 2005 14:52:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl6 book
Message-Id: <csls7q$3u7$3@mamenchi.zrz.TU-Berlin.DE>
Michele Dondi <bik.mido@tiscalinet.it> wrote in comp.lang.perl.misc:
> On 18 Jan 2005 11:04:23 -0800, ioneabu@yahoo.com wrote:
>
> >On Amazon there are two O'Reilly Perl 6 books.
> [snip]
> >I am thinking of getting the 2nd one for $2.82 just to have a look. Is
> >the Perl 6 info already wrong and outdated from one book to the other?
> >Do I really need to know all about Parrot right away?
>
> I read at a bookstore a large part of "Perl6 Essentials". I don't
> remember which edition it was, not that I care, and I doubt it
> matters: after staying for some time in p6l I realized it was obsolete
> the very moment trees were cut or even before...
While true, and acknowledged by the authors, this doesn't mean the book
is useless. The book doesn't (and can't) tell you how to program in Perl
6, but it does give you an idea what it will be like to program
in Perl 6, and that is much less likely to change. I, for one, have
bought it and enjoyed the outlook a lot, even if I know better than to
memorize syntax at this stage.
Anno
------------------------------
Date: 19 Jan 2005 07:20:15 -0800
From: "Jim Keenan" <jkeen_via_google@yahoo.com>
Subject: Re: Perl6 book
Message-Id: <1106148015.023029.79870@z14g2000cwz.googlegroups.com>
Michele Dondi wrote:
> On 18 Jan 2005 11:04:23 -0800, ioneabu@yahoo.com wrote:
>
> >On Amazon there are two O'Reilly Perl 6 books.
> [snip]
> >I am thinking of getting the 2nd one for $2.82 just to have a look.
Is
> >the Perl 6 info already wrong and outdated from one book to the
other?
> >Do I really need to know all about Parrot right away?
>
> I read at a bookstore a large part of "Perl6 Essentials". I don't
> remember which edition it was, not that I care, and I doubt it
> matters: after staying for some time in p6l I realized it was
obsolete
> the very moment trees were cut or even before...
>
An overly harsh judgment, IMHO.
I did not buy the first edition of the book; I waited for the second.
I do not regret buying it. Are you going to use it to implement
production code in Perl 6? No. But if you haven't had the time to
keep up with the development of Perl 6 as reported in the weekly
summaries, the second edition gives you a good starting point. I, for
one, found it a considerably more challenging read than I would have
expected.
Jim Keenan
------------------------------
Date: Wed, 19 Jan 2005 15:03:27 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: The world's shortest 'Hello World!' program: a proposal
Message-Id: <jrosu0lrffsj6css19fljp4tbmk1qobfqr@4ax.com>
On 18 Jan 2005 10:22:22 -0800, "Larry" <larry_wallet@yahoo.com> wrote:
>Having a superlative description of a language is a great promotional
>aid. For example: "best at text processing", "best for distributed web
>apps", "fastest for 3d games" etc...
Do we need more script kiddies, by any chance?
>One claim that Perl can make is one of the most simple and shortest
>'Hello World' programs.
I wouldn't think this as of being one of its strongest point nor one
of the reasons I love it so much, but...
>There is rumor on the web that there is another language which will
>execute the code:
>
>Hello World
>
>and print:
>
>Hello World
Good for them!
FWIW I would fear such a "feature".
>My proposal for Perl6 is to make Perl execute a sequence of code which
Please note that you should make your proposals for Perl6 in p6l.
I think you'll find, as I did myself, that people here is more
concerned, and by large, with how to do stuff in perl, rather than in
discussions about proposals about Perl{5,6}. (Even if I personally
whish there were more activity/responsiveness in this sense, but it
doesn't count.)
As a side note indeed large parts of Perl6's syntax and semantics are
still being actively redefined, rethought, etc. _but_ I doubt
(s/doubt/am sure/) that a similar proposal could ever be accepted, let
alone the motivations you gave for it...
>is 0 bytes in length with the action of printing to STDOUT:
_What_ is "0 bytes in length"? I can't see anything in your example!!
>Currently, attempting to execute a file or string of code with no
>content will do absolutely nothing.
HUH?!? What is "string of code with no content". Note that the empty
program _is_ a valid program, and it's also the simples trie, in that
it _does_ print itself, i.e. nothing.
>Of course, with the -W flag, Perl would continue to do nothing, and if
It's a particular idea of yours that "perl does nothing" when you give
it a script containing e.g. "hello world\n" and nothing else: it does
a whole lot of things, and it emits an error.
>one were to use strict, it would no longer be an empty file and
>therefore would properly execute by strictly doing absolutely nothing.
Another thing that you'll find out it that in Perl6 strict and
warnings will be turned on _by default_ in most cases, with the most
notable exception being given by one-liners specified by means of -e.
>The controversy in this proposal may be the way in which to state:
>
>Hello World
>
>Here are a few alternatives that have been used traditionally:
>
>Hello, World
>Hello, World!
>Hello world.
>hello world...
WHich drug are you taking? Can I have some?!?
>And with the current aggressiveness of Nasa in exploring new worlds,
>one might consider changing it to:
>
>Hello Worlds!
Wow, I didn't expect you to have such a brilliant sense of humor...
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: Wed, 19 Jan 2005 13:47:47 -0000
From: "Leonard Challis" <perl@lennychallis.co.uk>
Subject: Re: The world's shortest 'Hello World!' program: a proposal
Message-Id: <cslsic$ab1$1@newsg2.svr.pol.co.uk>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns95E2B2F0BEBADasu1cornelledu@132.236.56.8...
> "Leonard Challis" <perl@lennychallis.co.uk> wrote in news:csk2ht$udm$1
> @newsg2.svr.pol.co.uk:
>
>> "Ken" <x3v0-usenet@yahoo.com> wrote in message
>> news:gXeHd.59$dm5.17@fe37.usenetserver.com...
>>> Larry wrote:
>
> ...
>
>>>> One claim that Perl can make is one of the most simple and shortest
>>>> 'Hello World' programs.
> ...
>
>>>>
>>>
>>> lol (this IS a joke, right?)
>
>> Lol, I can't tell if it is or not, but it would be quit funny :D
>
> Please stop feeding the troll.
>
> Sinan.
That exactly what I mean about people getting flamed for no reason.
Seems to me some people have real social problems. It's a shame.
Lenny
------------------------------
Date: Wed, 19 Jan 2005 07:47:46 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Why doesn't this work?
Message-Id: <slrncusp82.5kj.tadmc@magna.augustmail.com>
David Filmer <IneverReadAnythingSentToMe@hotmail.com> wrote:
You should always enable warnings when developing Perl code!
> Why can't I say:
>
> print (gmtime(time))[2];
Because the parser sees a function call:
print (gmtime(time))
followed by
[2]
and gets confused.
> What's wrong with the first syntax?
You need to help the parser parse when you want an open paren
that follows a function name to NOT enclose the function's
argument list.
print ((gmtime(time))[2]); # use parens around arg list
or
print +(gmtime(time))[2]; # no paren following function name
See also the discussion in:
Message-Id: <slrnatq036.2q2.tadmc@magna.augustmail.com>
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 19 Jan 2005 14:38:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Why doesn't this work?
Message-Id: <cslrdn$3u7$2@mamenchi.zrz.TU-Berlin.DE>
Tad McClellan <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
> David Filmer <IneverReadAnythingSentToMe@hotmail.com> wrote:
>
> You should always enable warnings when developing Perl code!
You forgot "Please put the subject of your message in the Subject of your
message" :)
"Why doesn't this work?" is an especially egregious example of a thoughtless
and useless Subject.
The only part of a posting that *every* potential replier is going to see
is the Subject line, which is thus a key feature for a postings success
or failure. It pays to spend a moment to make it informative and appealing.
Unexperienced posters often throw in the first thing that comes to mind,
which is usually neither.
One good rule is: The Subject should be about the question you are asking
the group, not the question you are asking yourself.
Anno
------------------------------
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 7672
***************************************