[30150] in Perl-Users-Digest
Perl-Users Digest, Issue: 1393 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 26 03:09:51 2008
Date: Wed, 26 Mar 2008 00:09: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 Wed, 26 Mar 2008 Volume: 11 Number: 1393
Today's topics:
forward to another URL <nahanfee@gmail.com>
new CPAN modules on Wed Mar 26 2008 (Randal Schwartz)
Re: Pattern matching <deepan.17@gmail.com>
Re: perl pack string xhoster@gmail.com
Re: Readline using foreach and while <benkasminbullock@gmail.com>
Re: Readline using foreach and while <benkasminbullock@gmail.com>
Re: Readline using foreach and while <benkasminbullock@gmail.com>
Re: Readline using foreach and while <noreply@gunnar.cc>
Re: Readline using foreach and while <benkasminbullock@gmail.com>
Re: Readline using foreach and while <benkasminbullock@gmail.com>
Re: Readline using foreach and while <ben@morrow.me.uk>
Re: Readline using foreach and while xhoster@gmail.com
Re: Readline using foreach and while <szrRE@szromanMO.comVE>
Re: Readline using foreach and while <szrRE@szromanMO.comVE>
Re: Readline using foreach and while <szrRE@szromanMO.comVE>
What's better than Template Toolkit? <BLOCKSPAMfishfry@your-mailbox.com>
Re: What's better than Template Toolkit? <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 25 Mar 2008 23:38:31 -0700 (PDT)
From: Naved <nahanfee@gmail.com>
Subject: forward to another URL
Message-Id: <8388b9fc-137f-4f84-947b-d53d5ccfd49c@s12g2000prg.googlegroups.com>
Hello,
Can anyone tell me how can I forward to another URL from my page in
CGI PERL.
I don't want to use Redirect method as it is sending back to client
side and then redirecting the page.
Application::Forward is there but I don't get any example related to
that method.
It is not working properly, may be because I haven't implemented it
correctly.
any help will be appreciable.
Thanks in advance.
------------------------------
Date: Wed, 26 Mar 2008 04:42:17 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Mar 26 2008
Message-Id: <JyBMEH.18r2@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Algorithm-VectorClocks-0.1.1
http://search.cpan.org/~takeru/Algorithm-VectorClocks-0.1.1/
Generating a partial ordering of events in a distributed system
----
Astro-XSPEC-TableModel-0.01
http://search.cpan.org/~djerius/Astro-XSPEC-TableModel-0.01/
Create XSPEC FITS Table Models
----
Catalyst-Controller-Atompub-0.4.1
http://search.cpan.org/~takeru/Catalyst-Controller-Atompub-0.4.1/
A Catalyst controller for the Atom Publishing Protocol
----
Chooser-1.1.4
http://search.cpan.org/~vvelox/Chooser-1.1.4/
A system for choosing a value for something. Takes a string composed of various tests, arguements, and etc and returns a value based on it.
----
Config-INI-Access-0.99
http://search.cpan.org/~andy/Config-INI-Access-0.99/
Syntactic sugar for accessing data from .ini-files
----
DashProfiler-1.12
http://search.cpan.org/~timb/DashProfiler-1.12/
efficiently collect call count and timing data aggregated by context
----
Devel-NYTProf-1.12
http://search.cpan.org/~akaplan/Devel-NYTProf-1.12/
line-by-line code profiler and report generator
----
Emacs-Run-0.03
http://search.cpan.org/~doom/Emacs-Run-0.03/
utilities to assist in using emacs from perl via the shell
----
HTTP-Server-Simple-Dispatched-0.06
http://search.cpan.org/~frodwith/HTTP-Server-Simple-Dispatched-0.06/
Django-like regex dispatching with request and response objects - no CGI.pm cruft!
----
IO-Socket-TIPC-1.07
http://search.cpan.org/~infinoid/IO-Socket-TIPC-1.07/
TIPC sockets for Perl
----
Math-Expression-1.21
http://search.cpan.org/~addw/Math-Expression-1.21/
Evaluate arithmetic/string expressions
----
Math-Function-Roots-0.061
http://search.cpan.org/~sjo/Math-Function-Roots-0.061/
Functions for finding roots of arbitrary functions
----
NCGI-0.08
http://search.cpan.org/~mlawren/NCGI-0.08/
A Common Gateway Interface (CGI) Class
----
Net-FireEagle-0.9
http://search.cpan.org/~simonw/Net-FireEagle-0.9/
access Yahoo's new FireEagle location service
----
Net-LDAP-LDAPhash-1.0.2
http://search.cpan.org/~vvelox/Net-LDAP-LDAPhash-1.0.2/
Takes from a search and turns it into a hash.
----
POE-Component-DBIx-MyServer-0.01_05
http://search.cpan.org/~eriam/POE-Component-DBIx-MyServer-0.01_05/
A pseudo mysql POE server
----
Solaris-SysInfo-0.05
http://search.cpan.org/~pevans/Solaris-SysInfo-0.05/
A perl wrapper around Solaris' sysinfo(1) system call
----
Test-Server-0.04_02
http://search.cpan.org/~jkutej/Test-Server-0.04_02/
what about test driven administration?
----
Test-XML-Count-0.01
http://search.cpan.org/~akaplan/Test-XML-Count-0.01/
Perl extension for testing element count at a certain depth
----
Text-Printf-0.08
http://search.cpan.org/~roode/Text-Printf-0.08/
A simple, lightweight text fill-in class.
----
Text-SenseClusters-0.98
http://search.cpan.org/~tpederse/Text-SenseClusters-0.98/
: cluster similar contexts
----
WWW-Newzbin-0.05
http://search.cpan.org/~chrisn/WWW-Newzbin-0.05/
Interface to Newzbin.com's Usenet index
----
XML-Atom-Service-0.16.0
http://search.cpan.org/~takeru/XML-Atom-Service-0.16.0/
Atom Service Document object
----
XML-Compile-0.72
http://search.cpan.org/~markov/XML-Compile-0.72/
Compilation based XML processing
----
parent-0.221
http://search.cpan.org/~corion/parent-0.221/
Establish an ISA relationship with base classes at compile time
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 25 Mar 2008 21:00:42 -0700 (PDT)
From: Deepan Perl XML Parser <deepan.17@gmail.com>
Subject: Re: Pattern matching
Message-Id: <76d270ce-66da-4587-9563-2ee73e8ad05a@e10g2000prf.googlegroups.com>
On Mar 25, 7:13 pm, Lawrence Statton <yankeeinex...@gmail.com> wrote:
> Deepan Perl XML Parser <deepan...@gmail.com> writes:
>
>
>
> > No i am writing my own XML parser.
>
> Don't. There are many good XML parsers out there, the world doesn't
> need another one.
>
> --
> Lawrence Statton - lawrena...@abaluon.abaom s/aba/c/g
> Computer software consists of only two components: ones and
> zeros, in roughly equal proportions. All that is required is to
> place them into the correct order.
Okay then can you name any parsers that would get the CDATA section?
------------------------------
Date: 25 Mar 2008 22:09:57 GMT
From: xhoster@gmail.com
Subject: Re: perl pack string
Message-Id: <20080325181000.520$uq@newsreader.com>
unxl3arn3r <jsahiwal@gmail.com> wrote:
>
> Things would be easy to understand if there was a explanation of the
> what flags were meant to do what. Even docs are crap, so I can't be
> expected to master the perl msgrcv function without taking any help. I
> misunderstood pack and Ben both. Going back to read it again.
Perl's msgrcv is just fairly shallow wrapper around the system call of the
same name. To understand the flags, you should read the system's
documentation ("man msgrcv"). But mastering it seems to be something of
dubious value, to me. If you need to make your Perl script talk to your C
programs that use this type of message passing, then you should already
know all about this stuff from the C perspective, which will make it much
easier to understand if from Perl as well. And if you are just talking
Perl to Perl, I certainly would pick a different (more Perlish) method to
do so.
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: Tue, 25 Mar 2008 15:32:56 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Readline using foreach and while
Message-Id: <a0151264-4121-4f70-8c2e-1d956b7a0ab4@i12g2000prf.googlegroups.com>
On Mar 26, 1:37 am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth Ben Bullock <benkasminbull...@gmail.com>:
>
>
>
> > On Tue, 25 Mar 2008 11:59:23 +0000, John W. Krahn wrote:
> > > Ben Bullock wrote:
>
> > >> The foreach version seems to first read the whole of the file into an
> > >> array, and then go through it line by line:
>
> > > perldoc -q "What is the difference between a list and an array"
>
> > Found in /usr/local/lib/perl5/5.10.0/pod/perlfaq4.pod
> > What is the difference between a list and an array?
>
> > An array has a changeable length. A list does not.
>
> > If I had written "the foreach version reads the whole of the file into a
> > list", I would have contradicted this FAQ entry, which says I can't read
> > things into a list, because reading things into a list would change the
> > list's length, and "a list does not" have a changeable length.
>
> No, you're misunderstanding. A list is immutable *after it has been
> created*. Obviously you can create lists with any contents, otherwise
> you would be limited to using only lists compiled into perl. foreach
> accepts a list as argument and iterates over it; <> in list context
> (which is the real problem here) reads the entire file, splits it on
> newline (or rather $/), and returns a (newly created) list with the
> results. You can't modify the list after that: for an example where you
> can, see Tie::File, which reads a file into an *array* instead.
>
> Ben
------------------------------
Date: Tue, 25 Mar 2008 15:33:24 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Readline using foreach and while
Message-Id: <b3177160-23d2-49ad-83a0-89eddcd71455@s37g2000prg.googlegroups.com>
On Mar 26, 5:56 am, "John W. Krahn" <some...@example.com> wrote:
> We were talking about using a *list* in a foreach loop
You might have been, but I wasn't. I was talking about Perl reading in
data from a file.
------------------------------
Date: Tue, 25 Mar 2008 16:02:47 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Readline using foreach and while
Message-Id: <5bbdee24-16a7-4dad-87ab-e1b36a214726@d21g2000prf.googlegroups.com>
On Mar 26, 1:37 am, Ben Morrow <b...@morrow.me.uk> wrote:
> No, you're misunderstanding. A list is immutable *after it has been
> created*. Obviously you can create lists with any contents, otherwise
> you would be limited to using only lists compiled into perl.
If we can create lists, then there must be a data structures inside
Perl which represents those created lists. Let's call it the "newly-
created list" data structure. There is also a data structure for
arrays, of course.
Can you tell me the difference between the "newly-created lists" data
structure and the array data structure? Is there an example of Perl
code where we can see how the "newly-created lists" differ from
arrays? Or are these actually the same thing in practice?
> foreach
> accepts a list as argument and iterates over it; <> in list context
> (which is the real problem here) reads the entire file, splits it on
> newline (or rather $/), and returns a (newly created) list with the
> results. You can't modify the list after that
But I wasn't talking about modifying the list after that.
: for an example where you
> can, see Tie::File, which reads a file into an *array* instead.
OK:
http://perldoc.perl.org/Tie/File.html
But it says very shortly into the documentation "The file is not
loaded into memory" and "Changes to the array are reflected in the
file immediately". So your statement about "reads a file into an
array" is wrong. It is not reading the file into an array. It is
making a file appear to be an array. To read a file into an array use:
my @ary = <handle>;
Then one can loop over the array using
foreach (@ary)
------------------------------
Date: Wed, 26 Mar 2008 00:24:56 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Readline using foreach and while
Message-Id: <64tfqmF2de7gpU1@mid.individual.net>
Ben Bullock wrote:
> If we can create lists, then there must be a data structures inside
> Perl which represents those created lists. Let's call it the "newly-
> created list" data structure. There is also a data structure for
> arrays, of course.
>
> Can you tell me the difference between the "newly-created lists" data
> structure and the array data structure? Is there an example of Perl
> code where we can see how the "newly-created lists" differ from
> arrays? Or are these actually the same thing in practice?
C:\home>type test.pl
use warnings;
$var1 = qw/A B C/;
print "$var1\n";
@array = qw/A B C/;
$var2 = @array;
print "$var2\n";
C:\home>perl test.pl
Useless use of a constant in void context at test.pl line 2.
Useless use of a constant in void context at test.pl line 2.
C
3
C:\home>
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 25 Mar 2008 17:45:38 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Readline using foreach and while
Message-Id: <582b06b4-974f-4329-8270-d1e1858621a1@e23g2000prf.googlegroups.com>
On Mar 26, 8:24 am, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> Ben Bullock wrote:
> > If we can create lists, then there must be a data structures inside
> > Perl which represents those created lists. Let's call it the "newly-
> > created list" data structure. There is also a data structure for
> > arrays, of course.
>
> > Can you tell me the difference between the "newly-created lists" data
> > structure and the array data structure? Is there an example of Perl
> > code where we can see how the "newly-created lists" differ from
> > arrays? Or are these actually the same thing in practice?
>
> C:\home>type test.pl
> use warnings;
> $var1 = qw/A B C/;
> print "$var1\n";
> @array = qw/A B C/;
> $var2 = @array;
> print "$var2\n";
Thank you for making this example, but I'm interested in the
distinction between Ben Morrow's "newly-created lists" and arrays, not
the distinction between a compile-time list and an array. Your program
is merely an example of putting a compile-time list and an array into
scalar context.
------------------------------
Date: Tue, 25 Mar 2008 17:53:08 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Readline using foreach and while
Message-Id: <2b77c2e8-d38f-4183-a9e1-7229cea41ffb@s37g2000prg.googlegroups.com>
On Mar 26, 6:11 am, "John W. Krahn" <some...@example.com> wrote:
> Ben Bullock wrote:
> > On Tue, 25 Mar 2008 11:59:23 +0000, John W. Krahn wrote:
>
> >> Ben Bullock wrote:
>
> >>> The foreach version seems to first read the whole of the file into an
> >>> array, and then go through it line by line:
> >> perldoc -q "What is the difference between a list and an array"
>
> > Found in /usr/local/lib/perl5/5.10.0/pod/perlfaq4.pod
> > What is the difference between a list and an array?
>
> > An array has a changeable length. A list does not.
>
> > If I had written "the foreach version reads the whole of the file into a
> > list", I would have contradicted this FAQ entry, which says I can't read
> > things into a list, because reading things into a list would change the
> > list's length, and "a list does not" have a changeable length.
>
> The FAQ entry does not contain the phrase "read things into a list".
I'm extremely sorry but I really don't understand what you are talking
about. I originally wrote that "the foreach version seems to read
things into an array", then you posted the reference to the FAQ, then
I read it and tried to understand what you were saying. I assumed that
you meant that I should have written "the foreach version reads things
into a list". If that isn't what you meant, perhaps you could clarify?
Your original comment was fairly cryptic, and I spent quite a long
time trying to understand what you meant.
> print reverse grep /a/, readdir DIR;
>
> In the above example, where does grep() get its list from?
From "readdir DIR", presumably. You're not making much sense to me.
Could you please stop making cryptic comments and actually explain
what you're trying to say in a way which people who don't already know
what you are talking about can understand?
------------------------------
Date: Wed, 26 Mar 2008 00:52:10 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Readline using foreach and while
Message-Id: <qajob5-3q1.ln1@osiris.mauzo.dyndns.org>
Quoth Ben Bullock <benkasminbullock@gmail.com>:
> On Mar 26, 1:37 am, Ben Morrow <b...@morrow.me.uk> wrote:
>
> > No, you're misunderstanding. A list is immutable *after it has been
> > created*. Obviously you can create lists with any contents, otherwise
> > you would be limited to using only lists compiled into perl.
>
> If we can create lists, then there must be a data structures inside
> Perl which represents those created lists. Let's call it the "newly-
> created list" data structure.
Let's call it 'the stack'. Lists are ephemeral in Perl: they have no
existence beyond the end of the expression they are part of (counting
sub return and the corresponding call as two parts of a single
expression). If you want to keep them you have to assign them into an
array.
> There is also a data structure for arrays, of course.
Arrays are a real data structure, allocated somewhere on the heap, with
a normal ref-counted lifetime. This is, fundamentally, the difference
between the two.
> Can you tell me the difference between the "newly-created lists" data
> structure and the array data structure? Is there an example of Perl
> code where we can see how the "newly-created lists" differ from
> arrays? Or are these actually the same thing in practice?
Apart from the boring implementation details above, lists are read-only,
even when built from read-write values:
~% perl
my @ary = qw/a b c/;
$ary[0] = "f";
my ($x, $y, $z) = qw/a b c/;
($x, $y, $z)[0] = "f";
Can't modify list slice in scalar assignment at - line 4, near ""f";"
Execution of - aborted due to compilation errors.
~%
List assignment is an exception to this, of course. The only constant in
Perl is that every rule has an exception :).
> : for an example where you
> > can, see Tie::File, which reads a file into an *array* instead.
>
> OK:
>
> http://perldoc.perl.org/Tie/File.html
>
> But it says very shortly into the documentation "The file is not
> loaded into memory" and "Changes to the array are reflected in the
> file immediately". So your statement about "reads a file into an
> array" is wrong. It is not reading the file into an array. It is
> making a file appear to be an array.
Yes, of course. However, it is a closer fit to 'put this file into an
array' than @ary = <HANDLE>, because it is modifiable, and the
modifications turn up in the file just as you would expect.
> To read a file into an array use:
>
> my @ary = <handle>;
No. This reads the contents of the file into a list, and then assigns
that list to an array. The contents of the array are no longer anything
to do with the file. For instance,
my ($x, $y, $z, @foo) = <HANDLE>, qw/a b c/;
works perfectly well, or
my @random = List::Util::shuffle <HANDLE>;
> Then one can loop over the array using
>
> foreach (@ary)
Yes, if you must. However (and this was the original point), by this
time you've already read the whole file. If you're just going to process
it line-by-line that's (probably) a waste of time.
Ben
------------------------------
Date: 26 Mar 2008 02:46:19 GMT
From: xhoster@gmail.com
Subject: Re: Readline using foreach and while
Message-Id: <20080325224623.273$Qa@newsreader.com>
Ben Bullock <benkasminbullock@gmail.com> wrote:
> On Mar 26, 1:37 am, Ben Morrow <b...@morrow.me.uk> wrote:
>
> > No, you're misunderstanding. A list is immutable *after it has been
> > created*. Obviously you can create lists with any contents, otherwise
> > you would be limited to using only lists compiled into perl.
>
> If we can create lists, then there must be a data structures inside
> Perl which represents those created lists.
Not necessarily. A list might exist at the Perl-programmer interface
and not at the Perl-perl interface.
> Let's call it the "newly-
> created list" data structure. There is also a data structure for
> arrays, of course.
The list 1..5 might be represented in different data structures, depending
on how it is being used.
> OK:
>
> http://perldoc.perl.org/Tie/File.html
>
> But it says very shortly into the documentation "The file is not
> loaded into memory" and "Changes to the array are reflected in the
> file immediately". So your statement about "reads a file into an
> array" is wrong.
Only if an array is defined as being something in which is "in RAM".
I don't think that that is the case in Perl. So the file can be in
an array without being in RAM. A Perl array is a set of capabilities
and a syntax for accessing those capabilities.
> It is not reading the file into an array. It is
> making a file appear to be an array.
That is just nonsense. You don't have "open" file handles, either, Perl
just makes it look they are are. For that matter, files themselves
don't exist--the OS and the FS just cooperate to make it appear that way.
Heck, OSes don't even exist, the various components of the motherboard and
hard-drives just make it seem like they do.
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: Tue, 25 Mar 2008 20:57:52 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Readline using foreach and while
Message-Id: <fschk101orq@news2.newsguy.com>
comp.llang.perl.moderated wrote:
> On Mar 25, 1:57 pm, "szr" <sz...@szromanMO.comVE> wrote:
>> John W. Krahn wrote:
>>> Ben Bullock wrote:
>>>> On Mar 25, 4:25 pm, Saurabh Jain <hundredr...@gmail.com> wrote:
>>>>> Hi,
>>>>> Is there any difference in reading a file using a while or a
>>>>> foreach in perl?
>>
>>>> The foreach version seems to first read the whole of the file into
>>>> an array, and then go through it line by line:
>>
>>> perldoc -q "What is the difference between a list and an array"
>>
>> Array is the variable type, List is the type of valve an Array
>> takes/holds.
>>
>
> Actually, an array just holds scalars... or references which is a
> special type of scalar.
Isn't it more correct to say that an array holds a *list* of scalars? If
so, then it seems what I originally said is correct; an *array's*
*value* is a list, which contains scalars (numbers, strings, and refs.)
That is, a scalar take a number, string, or ref. An array takes a list
(which isa collection of scalars.) And by that token I suppose one could
say a hash's value is an even numbered list (key => val pairs) of
scalars :-)
--
szr
------------------------------
Date: Tue, 25 Mar 2008 21:21:30 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Readline using foreach and while
Message-Id: <fscj0a01q4j@news2.newsguy.com>
Ben Morrow wrote:
> Quoth Ben Bullock <benkasminbullock@gmail.com>:
>> On Tue, 25 Mar 2008 11:59:23 +0000, John W. Krahn wrote:
>>> Ben Bullock wrote:
>>
>>>> The foreach version seems to first read the whole of the file into
>>>> an array, and then go through it line by line:
>>>
>>> perldoc -q "What is the difference between a list and an array"
>>
>> Found in /usr/local/lib/perl5/5.10.0/pod/perlfaq4.pod
>> What is the difference between a list and an array?
>>
>> An array has a changeable length. A list does not.
>>
>> If I had written "the foreach version reads the whole of the file
>> into a list", I would have contradicted this FAQ entry, which says I
>> can't read things into a list, because reading things into a list
>> would change the list's length, and "a list does not" have a
>> changeable length.
>
> No, you're misunderstanding. A list is immutable *after it has been
> created*.
I think a better way of thinking about it is, a list is the literal
value used by na array, just like 123 and "abc" are literal values used
by scalars and too themselves not modifiyable.
It's like how in c and c++ you could initalize an array with a literal
value
(eg, int squares[5] = {1, 4, 9, 16, 25} )
Scalar variables are interfaces to manipulate numbers & strings.
Arrays (and Hashes**) are interfaces to manipulate Lists.
** I kind of look at the *value* of a Hash as being a (even numbered)
List, much like it is for an Array. You just access the List
differently. Arrays, by ordinals. Hashes, by key.
Comments and critisms welcome.
--
szr
------------------------------
Date: Tue, 25 Mar 2008 21:33:35 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Readline using foreach and while
Message-Id: <fscjmv01qqf@news2.newsguy.com>
Ben Morrow wrote:
> Quoth Frank Seitz <devnull4711@web.de>:
[...]
>>
>> use strict;
>> use warnings;
>>
>> my @a = qw/a b c/;
>> for my $v (@a) {
>> push @a,'d' if $v eq 'c';
>> print "$v\n";
>> }
>
> Good point. for is a little weird in this respect...
Nothing really weird about it. In that case above, it's no different
than:
for (my $i=0; $i<@a; $i++) {
my $v = $a[$i];
push @a,'d' if $v eq 'c';
print "$v\n";
}
In either case, it's going over the array, one element at a time, in
sequence, s oif you "push" something onto the end, it grows the array by
one and thus the for look keeps going.
--
szr
------------------------------
Date: Tue, 25 Mar 2008 22:38:22 -0700
From: fishfry <BLOCKSPAMfishfry@your-mailbox.com>
Subject: What's better than Template Toolkit?
Message-Id: <BLOCKSPAMfishfry-6C6867.22382225032008@comcast.dca.giganews.com>
I'm starting a little project. I've used TT for the front end before,
but it has some limitations and quirks as I'm sure people know. I was
wondering if anyone can recommend a better templating package.
------------------------------
Date: Wed, 26 Mar 2008 06:44:14 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: What's better than Template Toolkit?
Message-Id: <x7y786gf2a.fsf@mail.sysarch.com>
>>>>> "f" == fishfry <BLOCKSPAMfishfry@your-mailbox.com> writes:
f> I'm starting a little project. I've used TT for the front end before,
f> but it has some limitations and quirks as I'm sure people know. I was
f> wondering if anyone can recommend a better templating package.
take a look at Template::Simple. perfect for little projects and even
larger ones. it is easy to learn and use as it only has 4 markups but it
can do almost all you need in a template.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
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 1393
***************************************