[25010] in Perl-Users-Digest
Perl-Users Digest, Issue: 7260 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 16 11:06:58 2004
Date: Sat, 16 Oct 2004 08:05:09 -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 Sat, 16 Oct 2004 Volume: 10 Number: 7260
Today's topics:
Re: A perl reporting paradigm?? <tadmc@augustmail.com>
Re: anybody have a pre-made script that does this? <jurgenex@hotmail.com>
Re: C (I think) to Perl Conversion <santa@northpole.com>
Re: C (I think) to Perl Conversion <spamtrap@dot-app.org>
Re: criticize my code.. please? <usenet@morrow.me.uk>
Re: criticize my code.. please? <someone@example.com>
disappearing arguments when one package function calls (wana)
Re: disappearing arguments when one package function ca <spamtrap@dot-app.org>
Re: disappearing arguments when one package function ca <mritty@gmail.com>
Re: Installing extra data files with a Makefile.PL? <r.kobes@uwinnipeg.ca>
Re: passing hash of arrays by reference <usenet@morrow.me.uk>
Re: PCPRINT+CRLF perl script <tadmc@augustmail.com>
Re: PCPRINT+CRLF perl script <someone@example.com>
Re: perl and time <noreply@gunnar.cc>
Re: perl and time <tadmc@augustmail.com>
Re: perl and time <someone@example.com>
req: anybody have a pre-made script that does this? <santa@northpole.com>
Re: req: anybody have a pre-made script that does this? <tadmc@augustmail.com>
Re: String and Array Programming in Perl <tadmc@augustmail.com>
Re: Top 10 list algorithm <someone@example.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 16 Oct 2004 00:46:12 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: A perl reporting paradigm??
Message-Id: <slrncn1dd4.8vv.tadmc@magna.augustmail.com>
Sherm Pendley <spamtrap@dot-app.org> wrote:
> It's called a "here-doc". It's described in "perldoc perlop", in the
> "Quote and Quote-like Operators" section.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And it is in that section because it is merely another way of
quoting a string, hardly deserving of a "paradigm" label. :-)
(If you want Perl's "reporting paradigm" then you might
want to try: perldoc perlform
And if you want really rocking reports, use a CPAN module,
such as Text::Autoformat.
)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 16 Oct 2004 14:07:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: anybody have a pre-made script that does this?
Message-Id: <XW9cd.808$7d7.114@trnddc04>
Dear Santa
Santa Claus wrote:
> I need a pre-made script
You came to the wrong place. People here are very particular about this
being a newsgroup where to discuss the Perl programming language. They love
to improve programs and to investigate problems. But they loath being asked
for a ready-made solution. There are other sources for that, including
perl.jobs if it comes to that.
> that reads a mac os-x folder (hard coded in
> the script so the user can't modify it to another drive/folder)
Trivial, please see
perldoc -f opendir
perldoc -f readdir
> and
> display links to all files in the folder.
perldoc -f print
> They may be html, zip
> files, sit files, text files, jpeg files, whatever. I have a folder
> that i upload different files into on my web server for people to
> download and am getting tired of writing links for every single file
> and refuse to allow directory listing access so a script is necessary.
Oh, while writing to you: could you please bring me a 19" LCD monitor for
Christmas?
A new bluetooth wireless keyboard would be nice, too.
jue
------------------------------
Date: Sat, 16 Oct 2004 10:52:29 GMT
From: Santa Claus <santa@northpole.com>
Subject: Re: C (I think) to Perl Conversion
Message-Id: <santa-920B51.06545816102004@news-server-fe-02.columbus.rr.com>
In article <x7llefgpwu.fsf@mail.sysarch.com>,
Uri Guttman <uri@stemsystems.com> wrote:
> >>>>> "BW" == Brad Walton <sammie-nospam@greatergreen.com> writes:
>
> BW> I'm stuck here... I have a sample script which accomplishes the
> BW> task I need done, but it's done in another programing language (of
> BW> which I have no understanding). I have researched this for hours
> BW> and hours, but no luck.
>
> BW> ----
>
> BW> This is a longshot.. but I don't know what else to do.
>
> hire a programmer.
>
> uri
Actually the only suggestion I have is RTFM. I'm having a time trying
to understand c language myself however there are basic programming
principles you can use to understand what needs to be done and rewrite
it in whatever language you need. Try to simply understand the syntax
of the c language and then you're a long way into understanding what
needs to be done, you don't need to learn c completely.
{ is begin block
} is end block
( is begin parameter sending to another routine or beginning of math
routine that needs to be done first
) is end parameter block sending or end of a math routine that needs to
be done first
/* is begin comment
*/ is end comment
! is single line comment not requiring an end comment
You get the idea, use what you know to try to understand whatever
symbols you already know and look online for the symbols you don't know.
There are c manuals online that will assist in the deciphering the code
for you.
The last thing I want to tell you is something odd in c that i really
hate which os an advanced feature called operator overload. There's a
way that a person can override the + sign and make it into whatever they
want including the - sign. This is meant for those that read a program
and try to take out parts of it and make it not work for them, sort of
like programmer protection.
Hope this helps
------------------------------
Date: Sat, 16 Oct 2004 10:08:59 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: C (I think) to Perl Conversion
Message-Id: <2radnQv5Mu_htuzcRVn-2A@adelphia.com>
Santa Claus wrote:
> ! is single line comment not requiring an end comment
I don't know what language you're talking about, but it's not C.
Single-line comments in C begin with "//".
> There are c manuals online
Perhaps you should read one of them.
> The last thing I want to tell you is something odd in c that i really
> hate which os an advanced feature called operator overload.
That's C++. Operator overloading is not supported by C.
> way that a person can override the + sign and make it into whatever they
> want including the - sign. This is meant for those that read a program
> and try to take out parts of it and make it not work for them, sort of
> like programmer protection.
That's a load of pure BS. That is *NOT* what operator overloading is
meant for. It's meant for situations where you want to take the symantic
meaning that an operator already has, and apply that to object types.
For example, if you have a Matrix class, you can define a "*" operator
that takes two Matrix objects, performs matrix multiplication on them,
and returns the resulting Matrix object.
> Hope this helps
FUD never helps. Save the drek for the .advocacy groups.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 16 Oct 2004 12:53:17 +0100
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: criticize my code.. please?
Message-Id: <dme742-us4.ln1@osiris.mauzo.dyndns.org>
Quoth "Sergei Shelukhin" <raven_at@home.domonet.ru>:
> Hi ;)
> Here I prase opml blogroll into linkage database for my embarasingly
> primitive blog engine I wrote slowly to study Perl basics.
> One thing I already know is that common is an evil name for custom module. I
> will hcange that in production version ;)
> I am also aware of being able to refactor query-prepare out from the loop,
> running away to th uni now ;)
>
> #!/usr/bin/perl
> use strict;
use warnings;
> use lib qw(/usr/local/lib/perl5/site_perl/5.6.1);
> use lib qw(/home/virtual/html/raven.is.rathercute.com/cgi);
> use DBI;
> use XML::Parser;
> use XML::DOM;
> use IO::Handle;
> use common;
> ############################################################################
> ######
>
> my $db = Common::connect();
^
If you wish code to be criticised, please first make sure it runs. (Of
course, this *may* run, I suppose, if you have a case-insensitive
filesystem and the module calls itself Common internally, but then
you'll find your import is mysteriously not getting called...)
> my $io = new IO::Handle;
Why are you using IO::Handle? At least IMHO, it's much easier to use
5.6's lexical FHs.
> my $fname;
> my $new = 0;
> my $old = 0;
> my $p = new XML::DOM::Parser();
It is best not to declare variables until you need them.
> print "OPML file name: ";
> if (!$io->fdopen(fileno(STDIN),"r"))
Why are you doing this? What's wrong with STDIN?
> {
GNU-style indenting is not common in the Perl world.
if (...) {
# stuff
}
is much more common. See perlstyle.
> die "error initialising i/o";
> }
> $fname = $io->getline;
> my $opml = $p->parsefile($fname) or die "File not found";
> my $nodes = $opml->getElementsByTagName("outline");
> my $n = $nodes->getLength;
> $db->do("ALTER TABLE Linkage ADD COLUMN SaveMe bit");
> $db->do("UPDATE Linkage SET SaveMe = 0");
> $db->do("UPDATE Linkage SET SaveMe = 1 WHERE Blog = 0 OR Feed = ''");
> for (my $i = 0; $i < $n; $i++)
for my $i (0..$n) {
> {
> my $node = $nodes->item ($i);
> next if ($node->hasChildNodes); #outline cats
> my ($title,$url,$feed) = ($node->getAttributeNode("title")
> ,$node->getAttributeNode("htmlUrl"),$node->getAttributeNode("xmlUrl"));
Why do you use getAttributeNode instead of getAttribute?
It would be clearer to use a map here:
my ($title, $url, $feed) =
map { $node->getAttribute($_) } qw/title htmlURL xmlURL/;
> $title = $title->getValue if $title;
> $feed = $feed->getValue if $feed;
> if ($url )
> {
> $url = $url->getValue
> }
> else
> {
> # print "URL for the \"$title\" not found, please supply the url: ";
> # $url = $io->getline;
> $url = '';
> }
> my $query = $db->prepare("SELECT * FROM Linkage WHERE Feed = ?");
> $query->execute($feed);
> if (my $row = $query->fetchrow_hashref())
> {
> $db->do("UPDATE Linkage SET SaveMe = 1 WHERE Feed = ?",undef,$feed);
> ++$old;
> }
> else
> {
> $db->do("INSERT INTO Linkage (Name,Url,Feed,Blog,SaveMe) VALUES
> (?,?,?,1,1)",undef,$title,$url,$feed);
> ++$new;
> }
> }
> $db->do("DELETE FROM Linkage WHERE SaveMe = 0");
> $db->do("ALTER TABLE Linkage DROP COLUMN SaveMe");
> print "$new new feeds, $old old feeds\n";
> $io->close;
> $db->disconnect();
With warnings on you will get warned about statement handles still
existing when you disconnect. Destroy them by either scoping them so
they go out of scope before you get here (best) or calling $sth->finish.
You appear not to be using transactions; I would strongly advise setting
AutoCommit off on the database handle and doing a $db->commit at the
end.
Ben
--
I've seen things you people wouldn't believe: attack ships on fire off
the shoulder of Orion; I watched C-beams glitter in the dark near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. ben@morrow.me.uk
------------------------------
Date: Sat, 16 Oct 2004 13:13:16 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: criticize my code.. please?
Message-Id: <M79cd.8649$cr4.1729@edtnps84>
Ben Morrow wrote:
> Quoth "Sergei Shelukhin" <raven_at@home.domonet.ru>:
>>
>>my $n = $nodes->getLength;
>>$db->do("ALTER TABLE Linkage ADD COLUMN SaveMe bit");
>>$db->do("UPDATE Linkage SET SaveMe = 0");
>>$db->do("UPDATE Linkage SET SaveMe = 1 WHERE Blog = 0 OR Feed = ''");
>>for (my $i = 0; $i < $n; $i++)
>
> for my $i (0..$n) {
for my $i ( 0 .. $n - 1 ) {
John
--
use Perl;
program
fulfillment
------------------------------
Date: 16 Oct 2004 07:28:29 -0700
From: ioneabu@yahoo.com (wana)
Subject: disappearing arguments when one package function calls another
Message-Id: <bf0b47ca.0410160628.569940aa@posting.google.com>
I am packaging a set of commonly used functions to make my code a
little more easy to read. I called a package function with another
package function and the arguments I passed to it were not in @_ as
expected. I imagine if I passed by reference it might work or maybe I
need to use an array global to the package instead of @_, but those
solutions will take away from the simplicity I was hoping for. My
background is in C++ where this would be a normal way of doing things.
I found the chapter on symbol tables and packages in Programming Perl
to be a little confusing, but I thought that's where the answer would
be.
Here's the package (with irrelevant code removed). The problem comes
up when ReplaceInFile('one','two','file1','file2') calls LoadFromFile.
LoadFromFile does not receive any of the passed arguments.
package myfunctions
.
.
.
sub LoadFromFile
#takes array reference and file name as argument
#and clears array and fills array with file contents
{
my ($array, $filename) = @_;
open my $file, '<', $filename or die "Couldn't open $filename:
$!";
@{$array} = <$file>;
close $file or die "Error closing $filename: $!";
}
.
.
.
sub ReplaceInFile
{
#parameters
my $target = shift; #string to search for to replace
my $source = shift; #string to replace with
my $infile = shift;
my $outfile = shift;
#private variables
my @workspace;
LoadFromFile(@workspace,$infile);
foreach(@workspace) {s/$target/$source/g;}
SaveToFile(@workspace,$outfile);
}
1;
Thanks!
wana
------------------------------
Date: Sat, 16 Oct 2004 10:50:18 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: disappearing arguments when one package function calls another
Message-Id: <c9GdnRzBjem3qOzcRVn-tw@adelphia.com>
wana wrote:
> sub LoadFromFile
> #takes array reference and file name as argument
> #and clears array and fills array with file contents
> {
> my ($array, $filename) = @_;
But you're not passing it a reference. In C++ terms, you're using
pass-by-value here:
> LoadFromFile(@workspace,$infile);
To pass a reference to @workspace, you want to do this:
LoadFromFile(\@workspace, $infile);
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 16 Oct 2004 10:54:41 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: disappearing arguments when one package function calls another
Message-Id: <ckrcnq$h5r$1@misc-cct.server.rpi.edu>
wana wrote:
> I am packaging a set of commonly used functions to make my code a
> little more easy to read. I called a package function with another
> package function and the arguments I passed to it were not in @_ as
> expected. I imagine if I passed by reference it might work or maybe I
> need to use an array global to the package instead of @_, but those
> solutions will take away from the simplicity I was hoping for.
No they wouldn't. You would be adding exactly one character of code to
pass the array by reference, as it should be.
> package myfunctions
> .
> .
> .
> sub LoadFromFile
> #takes array reference and file name as argument
> #and clears array and fills array with file contents
You claim this function takes an array refernece.....
> {
> my ($array, $filename) = @_;
> open my $file, '<', $filename or die "Couldn't open $filename:
> $!";
> @{$array} = <$file>;
> close $file or die "Error closing $filename: $!";
> }
> .
> .
> .
> sub ReplaceInFile
> {
> #parameters
> my $target = shift; #string to search for to replace
> my $source = shift; #string to replace with
> my $infile = shift;
> my $outfile = shift;
>
> #private variables
> my @workspace;
>
> LoadFromFile(@workspace,$infile);
...But here you pass the function an empty list followed by $infile. If
you want LoadFromFile() to modify the array, you must pass a reference
to the array. Otherwise, you are only passing the contents of the array:
LoadFromFile(\@workspace, $infile);
> foreach(@workspace) {s/$target/$source/g;}
> SaveToFile(@workspace,$outfile);
> }
> 1;
Note that alternatively, you could provide LoadFromFile a prototype that
would specify the arguments it needs to receive:
sub LoadFromFile(\@$) {
#...
}
This would have the effect of automatically creating a reference to the
array passed in (so no further changes would be required to either your
LoadFromFile, nor to ReplaceInFile as you had written it).
Paul Lalli
------------------------------
Date: Sat, 16 Oct 2004 09:57:52 -0500
From: Randy Kobes <r.kobes@uwinnipeg.ca>
Subject: Re: Installing extra data files with a Makefile.PL?
Message-Id: <ckrctk$aqr$1@canopus.cc.umanitoba.ca>
Erik Wasser wrote:
> Hi Usenet,
>
> I have written a module with some additional files. These additional
> files are some kind of text database for running the module. My question
> is: how can I install these additional files with the 'Makefile.PL'? How
> can I bring Makefile.PL to copy some text files to '/usr/share/foobar'?
One way is to just set up a dialogue within Makefile.PL
(ExtUtils::MakeMaker has a prompt subroutine) to ask the
user where they want to install the data file, and then
just copy it over. Alternatively, you can add the relevant
command to the "install" target (see the section on overriding
MakeMaker methods in the ExtUtils::MakeMaker docs) to have
the file copied at the "make install" stage.
--
best regards,
randy kobes
------------------------------
Date: Sat, 16 Oct 2004 12:58:40 +0100
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: passing hash of arrays by reference
Message-Id: <g0f742-us4.ln1@osiris.mauzo.dyndns.org>
Quoth "Jerry Preston" <g-preston1@ti.com>:
>
> First I go out and collect a group of number and pass back:
>
> $RESULTS = $DAT->read_data( ""9994658", $DEBUG );
>
> This works great and I can print the contents:
>
> print " @{ $RESULTS->{ names }->{ 'Jerry' }";
No you can't. Please post actual code.
> Now I want to pass this to a sub to print out a graph using GD;
>
> &graph_data( $j, $x_label_o, $y_label_o, @{ $RESULTS->{ names }->{
> 'Jerry' }} );
Don't call subs with & unless you know why you are doing it.
> sub graph_data {
>
> my ( $date_type, $x_label, $y_label, @data ) = @_;
use Data::Dumper;
warn Dumper \@data;
or IMHO easier to understand and use, install Data::Dump and then
use Data::Dump qw/dump/;
warn dump \@data;
Check this is what you think it should be.
Ben
--
If you put all the prophets, | You'd have so much more reason
Mystics and saints | Than ever was born
In one room together, | Out of all of the conflicts of time.
ben@morrow.me.uk The Levellers, 'Believers'
------------------------------
Date: Sat, 16 Oct 2004 00:54:08 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: PCPRINT+CRLF perl script
Message-Id: <slrncn1ds0.8vv.tadmc@magna.augustmail.com>
vjp2.at@at.BioStrategist.dot.dot.com <vjp2.at@at.BioStrategist.dot.dot.com> wrote:
>
> How do I make this as simple as possible using perl instead of sed
>
>
> pcprint () { sed 's/$//' < $1 >> ~/pcprint.tmp; echo '' >> pcprint.tmp ;
^^^
^^^
replace
sed
with
perl -pe
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 16 Oct 2004 14:24:20 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: PCPRINT+CRLF perl script
Message-Id: <oaacd.8705$cr4.4449@edtnps84>
vjp2.at@at.BioStrategist.dot.dot.com wrote:
> How do I make this as simple as possible using perl instead of sed
>
> pcprint () { sed 's/$/
> /' < $1 >> ~/pcprint.tmp; echo '' >> pcprint.tmp ; /usr/local/bin/pcprint ~/pcprint.tmp ; rm ~/pcprint.tmp ;}
man s2p
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sat, 16 Oct 2004 13:14:11 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: perl and time
Message-Id: <2tcef1F1trjf6U1@uni-berlin.de>
Drunken Canadian wrote:
>
> time A = 00:01:04
> time b = 0:0:58
>
> how can i add the two times to be 00:02:02?
sub addtime {
my @t1 = split /:/, shift;
my @t2 = split /:/, shift;
my $sec = ($t1[0]+$t2[0])*3600 +
($t1[1]+$t2[1])*60 + $t1[2]+$t2[2];
sprintf '%02d:%02d:%02d', (gmtime $sec)[2,1,0]
}
print addtime('00:01:04', '0:0:58'), "\n";
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 16 Oct 2004 08:43:03 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: perl and time
Message-Id: <slrncn29b7.a17.tadmc@magna.augustmail.com>
Drunken Canadian <nospam@email.plz> wrote:
> time A = 00:01:04
> time b = 0:0:58
> I know the format is not the same but that is what im stuck with....
You can normalize to a more convenient format:
$time = sprintf '%02d:%02d:%02d', split /:/, $time;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 16 Oct 2004 14:08:40 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: perl and time
Message-Id: <IX9cd.8691$cr4.3182@edtnps84>
Drunken Canadian wrote:
> Ok this may be a noob question but it almost 6am and the coffiee is no
> longer working ......
>
> time A = 00:01:04
> time b = 0:0:58
>
> how can i add the two times to be 00:02:02?
> I know the format is not the same but that is what im stuck with....
$ perl -e'
$a = "00:01:04";
$b = "0:0:58";
printf "%10s%10s\n", $a, $b;
$x = 2; $d += $_ * 60 ** $x-- for $a =~ /\d+/g;
$x = 2; $e += $_ * 60 ** $x-- for $b =~ /\d+/g;
printf "%10s%10s\n", $d, $e;
$c = $d + $e;
printf "%02d:%02d:%02d\n", reverse $c % 60, int($c /= 60) % 60, int($c /= 60)
% 60;
'
00:01:04 0:0:58
64 58
00:02:02
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sat, 16 Oct 2004 11:09:05 GMT
From: Santa Claus <santa@northpole.com>
Subject: req: anybody have a pre-made script that does this?
Message-Id: <santa-ECEF0D.07113416102004@news-server-fe-02.columbus.rr.com>
I need a pre-made script that reads a mac os-x folder (hard coded in the
script so the user can't modify it to another drive/folder) and display
links to all files in the folder. They may be html, zip files, sit
files, text files, jpeg files, whatever. I have a folder that i upload
different files into on my web server for people to download and am
getting tired of writing links for every single file and refuse to allow
directory listing access so a script is necessary.
------------------------------
Date: Sat, 16 Oct 2004 08:51:27 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: req: anybody have a pre-made script that does this?
Message-Id: <slrncn29qv.a17.tadmc@magna.augustmail.com>
Santa Claus <santa@northpole.com> wrote:
> I need a pre-made script
Then you are in the wrong place.
This is a newsgroup for discussing _programming_ in Perl, not for
finding programs written in Perl.
Use a search engine for searching.
A program to do what you describe would only be about a dozen lines
long anyway, so there isn't much point in packaging one up for
distribution.
If you should decide to learn enough Perl to write those dozen lines,
then post your code here when you get stuck, and we will help
you fix it.
> that reads a mac os-x folder
perldoc -f opendir
perldoc -f readdir
perldoc -f closedir
perldoc -f glob
> and display
> links to all files in the folder.
perldoc -f readlink
perldoc -f -X
> on my web server
Oh.
"link" doesn't mean link when you say it, it means "hyperlink"
when you say it. You won't need readlink() then, just print().
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 16 Oct 2004 00:35:25 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: String and Array Programming in Perl
Message-Id: <slrncn1cot.8vv.tadmc@magna.augustmail.com>
Peter Wyzl <wyzelli@yahoo.com> wrote:
> From: "Tad McClellan" <tadmc@augustmail.com>
>> DeveloperGuy <Phillip.Small@gmail.com> wrote:
>>
>>> for ($count= 0; $count <= $#users; $count++;) {
>>
>> A more Perlish way to get the same thing is:
>>
>> foreach my $count ( 0 .. $#users ) {
>
> Even more 'Perlish' would be
>
> for my $count (@users){
But that doesn't "get the same thing".
(and you wouldn't call it "count" when it wasn't a count)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 16 Oct 2004 12:42:43 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Top 10 list algorithm
Message-Id: <7H8cd.8644$cr4.574@edtnps84>
Shawn Corey wrote:
>> Which documentation?
>
> perldoc -f splice
What do you think I didn't read correctly?
John
--
use Perl;
program
fulfillment
------------------------------
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 7260
***************************************