|
|
Up |
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Jan 7, 2007 18:03
This is an excerpt from the latest version perlfaq2.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
2.9: What are the Perl newsgroups on Usenet? Where do I post questions?
Several groups devoted to the Perl language are on Usenet:
comp.lang.perl.announce Moderated announcement group
comp.lang.perl.misc High traffic general Perl discussion
comp.lang.perl.moderated Moderated discussion group
comp.lang.perl.modules Use and development of Perl modules
comp.lang.perl.tk Using Tk (and X) from Perl
comp.infosystems.www.authoring.cgi Writing CGI scripts for the Web.
|
| Show full article (2.80Kb) |
|
| |
no comments
|
|
  |
Author: Jürgen ExnerJürgen Exner
Date: Jan 7, 2007 17:33
Mark Hobley wrote:
> Having done some googling, it appears that nesting a foreach loop
> would have worked in the expected manner, because the iterator is
> preserved on entry and exit from the loop, but this does not happen
> with a for loop.
You are mistaken. From "perldoc perlsyn":
The "foreach" keyword is actually a synonym for the "for" keyword, so
you can use "foreach" for readability or "for" for brevity.
jue
|
| |
|
| |
1 Comment |
|
  |
Author: Mark HobleyMark Hobley
Date: Jan 7, 2007 17:04
In alt.perl Gunnar Hjalmarsson wrote:
> foreach my $loop ( 0..3 ) {
Ok, that is clever, but what if I wanted 1 to 50000?
Wouldn't that generate 50000 temporary values in memory to feed the loop, as
opposed to just one value iterating 50000 times?
Regards,
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Telephone: (0121) 247 1596
International: 0044 121 247 1596
Email: markhobley at hotpop dot donottypethisbit com
http://markhobley.yi.org/
|
| |
|
1 Comment |
|
  |
Author: Mark HobleyMark Hobley
Date: Jan 7, 2007 17:04
In alt.perl Paul Lalli gmail.com> wrote:
> What were you expecting it to do?
I was expecting a nested loop with the inner iterator not affecting the outer
loop, ie the inner iterator scope is local to the inner loop.
Having done some googling, it appears that nesting a foreach loop would have
worked in the expected manner, because the iterator is preserved on entry and
exit from the loop, but this does not happen with a for loop.
> You can, however, localize $_, at the start of each loop.
Ok. Thanks for the input.
Regards,
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Telephone: (0121) 247 1596
International: 0044 121 247 1596
|
| Show full article (0.77Kb) |
|
no comments
|
|
  |
Author: Arved SandstromArved Sandstrom
Date: Jan 7, 2007 16:34
>
> Arved Sandstrom wrote:
>> "Abigail" wrote in message
>>> I'd use 'grep', not perl.
>>
>> Get over being so elitist.
>
> wait a minute, you believe that using grep is pretentious? hahaha
>
> someone better tell Dennis Ritchie.
Assuming that the reader is *not* using the most common OS on the planet is
pretentious. Abigail's entire post was useless - she gave no information.
She informed everyone that she is sarcastic (in the case of the first
answer), and that she prefers UNIX/Linux (in the case of the second). At
least I assume she prefers UNIX/Linux. As it happens so do I, but I am a
professional software developer and don't assume everyone uses a flavour of
*nix.
|
| Show full article (1.26Kb) |
|
no comments
|
|
  |
Author: JohnJohn
Date: Jan 7, 2007 15:52
I'm working on a Windows application that grabs GPS and Iperf data. My
app accesses the GPS receiver through a serial port by way of
GPS::NMEA, and it gets the Iperf data by way of `iperf -c $options`.
The backquoted command works until a GPS capture has been performed,
but after even a single GPS capture the backquoted Iperf command, in
fact *any* backquoted command, causes my app to hang. An attempt to
have the command pipe its output to a filehandle gives the same result.
Note: My GPS code closes the serial port after each capture.
|
| |
|
no comments
|
|
  |
Author: Mark HobleyMark Hobley
Date: Jan 7, 2007 14:04
The iterator special variable can be used in a foreach loop as follows:
@fruit = ( "apples", "bananas", "cherries" );
foreach (@fruit) {
print "I like $_\n";
}
Is it accepted to use the special variable in a for loop as follows?
use strict;
use warnings;
for ($_=0; $_ <=9; $_++) {
print "$_\n";
}
(The above works and I get no errors.)
Would you expect nested loops using the iterator variable to work?
|
| Show full article (1.05Kb) |
|
5 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Jan 7, 2007 06:03
This is an excerpt from the latest version perlfaq3.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
3.9: Is there a ctags for Perl?
(contributed by brian d foy)
Ctags uses an index to quickly find things in source code, and many
popular editors support ctags for several different languages, including
Perl.
Exuberent ctags supports Perl: http://ctags.sourceforge.net/
You might also try pltags: http://www.mscha.com/pltags.zip
--------------------------------------------------------------------
|
| Show full article (1.40Kb) |
|
no comments
|
|
  |
Author: Perl LoverPerl Lover
Date: Jan 6, 2007 19:52
I am writing a generic tool in perl DBD to compare data between
two tables and sync them up. The tables are guranteed to have
a primary key or unique index. One table is designated as the
base table and the other table as the target table where changes
from the base table will be applied.
The logic I am following is to select all rows from the base table
and pick its primary key, row by row. Then do a select on the
target table based on the primary key and compare the result
of the two rows (one from base table and the other from the target
table).
Can I make it faster by any other method.
|
| |
|
2 Comments |
|
  |
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Jan 6, 2007 18:03
This is an excerpt from the latest version perlfaq2.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
2.17: What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?
Perl.com at http://www.perl.com/ is part of the O'Reilly Network, a
subsidiary of O'Reilly Media.
The Perl Foundation is an advocacy organization for the Perl language
which maintains the web site http://www.perl.org/ as a general advocacy
site for the Perl language. It uses the domain to provide general
support services to the Perl community, including the hosting of mailing
lists, web sites, and other services. The web site http://www.perl.org/
is a general advocacy site for the Perl language, and there are many
other sub-domains for special topics, such as
|
| Show full article (2.33Kb) |
|
no comments
|
|
|
|
|
|
|