[30808] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2053 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 13 03:09:42 2008

Date: Sat, 13 Dec 2008 00:09:07 -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           Sat, 13 Dec 2008     Volume: 11 Number: 2053

Today's topics:
    Re: a simple control in an nntp client <george@example.invalid>
    Re: a simple control in an nntp client <tadmc@seesig.invalid>
    Re: a simple control in an nntp client <tim@burlyhost.com>
    Re: a simple control in an nntp client <jurgenex@hotmail.com>
    Re: a simple control in an nntp client <jurgenex@hotmail.com>
    Re: herding ones and zeroes into bytes <george@example.invalid>
    Re: herding ones and zeroes into bytes <jurgenex@hotmail.com>
    Re: herding ones and zeroes into bytes <george@example.invalid>
    Re: herding ones and zeroes into bytes <tim@burlyhost.com>
        MIME::Lite -- Add attribute to part's Content-Type <jerry@ieee.org>
        new CPAN modules on Sat Dec 13 2008 (Randal Schwartz)
    Re: Try to exit inner loop and start next iteration of  <uri@stemsystems.com>
    Re: Try to exit inner loop and start next iteration of  <someone@example.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 12 Dec 2008 19:45:14 -0700
From: George <george@example.invalid>
Subject: Re: a simple control in an nntp client
Message-Id: <3q9joihkesl9.caekifb8ujda.dlg@40tude.net>

On Sat, 06 Dec 2008 19:21:08 -0800, Tim Greer wrote:


> A lot of people on this news group have filtered out the "sln" poster,
> you might consider doing the same and saving the grief of dealing with
> him.  Not only does he argue with people when he doesn't get humor, but
> he argues with himself as well.  Filtering him out will save a lot of
> nonsense.

I don't hang around long enough to foster antipathies except to the worst
of persons who violate civility.  sln did give a working perl soln to my
bits/bytes problem, which I didn't ask for--actually I did but didn't mean
to--but was glad to have a solution in a another syntax.  I keep on pecking
away at perl; one of these days I'll be able to use it skillfully.

If $from_offset is defined so:

# Which XOVER fields contain Subject: and From:?
my $count = 0;
my %xover_fmt = map( ($_, $count++), @{ $nntp->overview_fmt or die} );
die unless exists $xover_fmt{'Subject:'};
my $subject_offset = $xover_fmt{'Subject:'};
my $from_offset = $xover_fmt{'From:'};


, and this works:

my $s4 = join( map ($_->[$from_offset],@xover));

print STDOUT " s4 is $s4\n";

, why doesn't this:

if ($_->[$from_offset] eq "George <george@example.invalid>")
{
print STDOUT "got a match\n";
}

perl.exe says:

Use of uninitialized value in string eq at script2.pl line 58.

where line 58 is the test condition on the if control.

-- 
George

I believe that God has planted in every heart the desire to live in
freedom.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


------------------------------

Date: Fri, 12 Dec 2008 21:47:14 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: a simple control in an nntp client
Message-Id: <slrngk6c22.4g9.tadmc@tadmc30.sbcglobal.net>

George <george@example.invalid> wrote:


> if ($_->[$from_offset] eq "George <george@example.invalid>")


Execute this Perl program:

    $_ = "George <george@example.invalid>";
    print;

and then use single quotes instead.

:-)


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Fri, 12 Dec 2008 20:27:38 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: a simple control in an nntp client
Message-Id: <_QG0l.26379$v37.2633@newsfe01.iad>

George wrote:

> , why doesn't this:
> 
> if ($_->[$from_offset] eq "George <george@example.invalid>")
> {
> print STDOUT "got a match\n";
> }
> 
> perl.exe says:
> 
> Use of uninitialized value in string eq at script2.pl line 58.
> 
> where line 58 is the test condition on the if control.

I think you meant "George <george\@example.invalid>" or else 'George
<george@example.invalid>', otherwise @example will mean something else.
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


------------------------------

Date: Fri, 12 Dec 2008 22:12:55 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: a simple control in an nntp client
Message-Id: <bdk6k4dhk5kba97kaa48gri5dk4de2jhsn@4ax.com>

George <george@example.invalid> wrote:
>if ($_->[$from_offset] eq "George <george@example.invalid>")
>
>perl.exe says:
>
>Use of uninitialized value in string eq at script2.pl line 58.
>
>where line 58 is the test condition on the if control.

Well, what value does the array @example have?
Had you used warnings and strict as has been strongly recommended over
and over again then perl would (probably) have warned you at compile
time that @example was undefined.

jue


------------------------------

Date: Fri, 12 Dec 2008 22:31:44 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: a simple control in an nntp client
Message-Id: <ill6k41e9372pkbgb7ked17v60psbq8o10@4ax.com>

Jürgen Exner <jurgenex@hotmail.com> wrote:
>George <george@example.invalid> wrote:
>>if ($_->[$from_offset] eq "George <george@example.invalid>")
>>
>>perl.exe says:
>>
>>Use of uninitialized value in string eq at script2.pl line 58.
>>
>>where line 58 is the test condition on the if control.
>
>Well, what value does the array @example have?
>Had you used warnings and strict as has been strongly recommended over
>and over again then perl would (probably) have warned you at compile
>time that @example was undefined.

s/undefined/undeclared/

of course

jue


------------------------------

Date: Fri, 12 Dec 2008 18:54:45 -0700
From: George <george@example.invalid>
Subject: Re: herding ones and zeroes into bytes
Message-Id: <1l71zxjd5myvv.djxnl98i9hr6.dlg@40tude.net>

On Tue, 09 Dec 2008 21:19:51 GMT, sln@netherlands.com wrote:


> For the Perl equivalent, you have to xor the free extension
> course C code and shift left by 3 bits. Where do you think Perl
> came from anyway?

You don't seem to have any bitshifts, even if the ultimate number of bits
is not 8.

> 
> Typical George W. Bush fan..

That I ask on-line evidences of curiosity, which, along with integrity and
ability, seem completely absent in the texas cocksucker. 

> 
> sln
> ======================================
> 
> use strict;
> use warnings;
> 
> my $cpos = tell( DATA);
> my $Bits = '';
> 
> ## inline ...
> while(<DATA>) {
> 	chomp; $Bits.=$_;
> 	while ($Bits =~ s/(\d{8})//) {
> 		printf ("%02x\n", oct('0b'.$1));
> 	}
> }
> print "\n";
> 
> # or simply, all at once ...
> seek (DATA,$cpos,0);
> $Bits = '';
> while(<DATA>) { chomp; $Bits.=$_ }
> while ($Bits =~ /(\d{8})/g) {
> 	printf ("%02x\n", oct('0b'.$1));
> }
> 
> __DATA__
> 0001000000000000001
> 0001000000000000001
> 10000011001000000000000001
> 10000011001000000000000001
> 10000011001000000000000001
> 10000011001000000000000001
> 10000011001000000000000001
> 10000011001000000000000001
> 10000011001000000000000001
> 10000011001000000000000001
> 100000001111100
> 100000001111100
> 100000001111100
> 1000001110110111100000000000001
> 1000001110110111100000000000001
> 1000001110110111100000000000001
> 1000001110110111100000000000001
> 1000001110110111100000000000001
> 1000001110110111100000000000001
> 0001000000000000001

This script works flawlessly:


10
00
22
00
06
0c
80
01
83
20
00
 ...
07
6f
00
06
0e
de
00
08
80
01

, which matches the output in a syntax I know better:

C:\MinGW\source>x
 Number of bytes written =  62

C:\MinGW\source>dump bin4.dat

C:\MinGW\source>od -tx1 -Ax -v bin4.dat
000000 10 00 22 00 06 0c 80 01 83 20 00 60 c8 00 18 32
000010 00 06 0c 80 01 83 20 00 60 c8 00 18 32 00 06 03
000020 e4 07 c8 0f 90 76 f0 00 60 ed e0 00 c1 db c0 01
000030 83 b7 80 03 07 6f 00 06 0e de 00 08 80 01
00003e

while(<DATA>) { chomp; $Bits.=$_ }

How does this execute?
-- 
George

For diplomacy to be effective, words must be credible - and no one can now
doubt the word of America.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


------------------------------

Date: Fri, 12 Dec 2008 18:48:39 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: herding ones and zeroes into bytes
Message-Id: <vg86k4tm57chejievaugdssr6ph1jc67o1@4ax.com>

George <george@example.invalid> wrote:
> For diplomacy to be effective, words must be credible - and no one can now
> doubt the word of America.
> George W. Bush

It is better to keep quiet and let people wonder if you are an idiot
than to open your mouth and remove any doubt.
-Unknown author


------------------------------

Date: Fri, 12 Dec 2008 21:28:06 -0700
From: George <george@example.invalid>
Subject: Re: herding ones and zeroes into bytes
Message-Id: <1o25rqlh4p3lu.16t09wglznhar$.dlg@40tude.net>

On Fri, 12 Dec 2008 18:48:39 -0800, Jürgen Exner wrote:

> George <george@example.invalid> wrote:
>> For diplomacy to be effective, words must be credible - and no one can now
>> doubt the word of America.
>> George W. Bush
> 
> It is better to keep quiet and let people wonder if you are an idiot
> than to open your mouth and remove any doubt.
> -Unknown author

I thought that was attributed to Mark Twain.

Words are important.  Who is Condie Rice talking about when she says:

1)  Sham election
2)  Sham power-sharing
3)  This president must go.

During the Georgia conflict, she said "nations just don't invade each other
in the 21st century."  My jaw dropped.
-- 
George

Senator Kerry has been in Washington long enough to take both sides on just
about every issue.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


------------------------------

Date: Fri, 12 Dec 2008 20:31:06 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: herding ones and zeroes into bytes
Message-Id: <eUG0l.26380$v37.15889@newsfe01.iad>

George wrote:

> During the Georgia conflict, she said "nations just don't invade each
> other in the 21st century."  My jaw dropped.

Luckily, things should start improving in about 37 days.

http://punditkitchen.files.wordpress.com/2008/11/political-pictures-barack-obama-white-house-complete-sentences.jpg

(pardon the word-wrap)
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


------------------------------

Date: Fri, 12 Dec 2008 16:10:10 -0800 (PST)
From: Jerry Krinock <jerry@ieee.org>
Subject: MIME::Lite -- Add attribute to part's Content-Type
Message-Id: <4a5af1eb-4e9e-4425-89d1-7aa40b271bcc@r15g2000prd.googlegroups.com>

When Apple's Mail.app composes a message with a .zip attachment, it
adds an "x-mac-auto-archive" attribute to Content-Type, which I
believe tells the receiving Mail.app to automatically unzip the
attachment upon receipt.  I would like to be able to send messages
behaving like that when I use MIME::Lite.  Taking a wild guess, I
wrote this code:

    $msg->attach(
        Type     => 'application/zip',
        Path     => $myPath,
        'x-mac-auto-archive' => 'yes',
        Filename => "MyScript.app.zip"
    ) ;

What I get from that (which fails to make Mail.app automatically
unzip) is:

   Content-Type: application/zip; name="MyScript.app.zip"
   X-Mac-Auto-Archive: yes

A similar message sent by the real Mail.app gives me a Content-Type
like this:

   Content-Type: application/zip;
        x-mac-auto-archive=yes;
        name="MyScript.app.zip"

Apparently, the problem is that instead of becoming an attribute of
Content-Type, my x-mac-auto-archive becomes a Header field.  (I hope
my terminology is correct.)

I poked around in the MIME::Lite source code for a while but didn't
get anywhere.  Does anyone know how to set an custom attribute ^of^ a
header field using Perl?

Sincerely,

Jerry Krinock


------------------------------

Date: Sat, 13 Dec 2008 05:42:24 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Dec 13 2008
Message-Id: <KBsvuo.1oyL@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.

Acme-Magpie-0.06
http://search.cpan.org/~rclamp/Acme-Magpie-0.06/
steals shiny things 
----
Advent-Bundles-0.02
http://search.cpan.org/~davidrw/Advent-Bundles-0.02/
Collection of year-by-year Bundles of the Perl Advent Calendar modules 
----
Apache2-ASP-2.09
http://search.cpan.org/~johnd/Apache2-ASP-2.09/
ASP for Perl, reloaded. 
----
App-CPAN-Mini-Visit-v0.2.0
http://search.cpan.org/~dagolden/App-CPAN-Mini-Visit-v0.2.0/
explore each distribution in a minicpan repository 
----
App-CPAN-Mini-Visit-v0.3.0
http://search.cpan.org/~dagolden/App-CPAN-Mini-Visit-v0.3.0/
explore each distribution in a minicpan repository 
----
App-CPAN-Mini-Visit-v0.3.1
http://search.cpan.org/~dagolden/App-CPAN-Mini-Visit-v0.3.1/
explore each distribution in a minicpan repository 
----
B-Compiling-0.01
http://search.cpan.org/~flora/B-Compiling-0.01/
Expose PL_compiling to perl 
----
B-Hooks-Parser-0.08
http://search.cpan.org/~flora/B-Hooks-Parser-0.08/
Interface to perls parser variables 
----
Business-Address-POBox-0.09
http://search.cpan.org/~marcel/Business-Address-POBox-0.09/
Check whether an address looks like a P.O.Box 
----
Catalyst-View-TT-XHTML-1.000
http://search.cpan.org/~bobtfish/Catalyst-View-TT-XHTML-1.000/
A sub-class of the standard TT view which serves application/xhtml+xml content if the browser accepts it. 
----
Catalyst-View-TT-XHTML-1.001
http://search.cpan.org/~bobtfish/Catalyst-View-TT-XHTML-1.001/
A sub-class of the standard TT view which serves application/xhtml+xml content if the browser accepts it. 
----
CatalystX-CRUD-Model-RDBO-0.19
http://search.cpan.org/~karman/CatalystX-CRUD-Model-RDBO-0.19/
Rose::DB::Object CRUD 
----
CatalystX-CRUD-YUI-0.012
http://search.cpan.org/~karman/CatalystX-CRUD-YUI-0.012/
YUI for your CatalystX::CRUD view 
----
Chart-OFC2-0.03_02
http://search.cpan.org/~jkutej/Chart-OFC2-0.03_02/
Generate html and data files for use with Open Flash Chart version 2 
----
ClearPress-293
http://search.cpan.org/~rpettett/ClearPress-293/
Simple, fresh & fruity MVC framework 
----
Clone-0.30
http://search.cpan.org/~rdf/Clone-0.30/
recursively copy Perl datatypes 
----
Config-File-1.45
http://search.cpan.org/~gwolf/Config-File-1.45/
Parse a simple configuration file 
----
Config-File-1.46
http://search.cpan.org/~gwolf/Config-File-1.46/
Parse a simple configuration file 
----
Crypt-OpenSSL-RC4-0.02
http://search.cpan.org/~tokuhirom/Crypt-OpenSSL-RC4-0.02/
RC4 library based on OpenSSL 
----
Fir-0.33
http://search.cpan.org/~lbrocard/Fir-0.33/
a Tree::DAG_Node subclass for menu nagivation 
----
FramesReady-1.017
http://search.cpan.org/~derhaag/FramesReady-1.017/
a frames-capable version of LWP::UserAgent 
----
GD-Chord-Piano-0.0.5
http://search.cpan.org/~bayashi/GD-Chord-Piano-0.0.5/
Generate Chord Table of Piano 
----
GSAPI-0.5
http://search.cpan.org/~oesi/GSAPI-0.5/
Perl extension for accessing GNU Ghostscript 
----
Games-GuessWord-0.16
http://search.cpan.org/~lbrocard/Games-GuessWord-0.16/
Guess the letters in a word (ie Hangman) 
----
Git-PurePerl-0.37
http://search.cpan.org/~lbrocard/Git-PurePerl-0.37/
A Pure Perl interface to Git repositories 
----
GraphViz-2.04
http://search.cpan.org/~lbrocard/GraphViz-2.04/
Interface to the GraphViz graphing tool 
----
HTML-Toc-1.10
http://search.cpan.org/~fvulto/HTML-Toc-1.10/
Generate, insert and update HTML Table of Contents. 
----
HTTP-Session-Store-DBI-0.02
http://search.cpan.org/~fayland/HTTP-Session-Store-DBI-0.02/
store session data in DBI for HTTP::Session 
----
IO-All-0.39
http://search.cpan.org/~ingy/IO-All-0.39/
IO::All of it to Graham and Damian! 
----
Image-Magick-Chart-1.03
http://search.cpan.org/~rsavage/Image-Magick-Chart-1.03/
Use Image::Magick to create charts. 
----
Image-WorldMap-0.15
http://search.cpan.org/~lbrocard/Image-WorldMap-0.15/
Create graphical world maps of data 
----
Imager-0.67
http://search.cpan.org/~tonyc/Imager-0.67/
Perl extension for Generating 24 bit Images 
----
Kephra-0.4.0_4
http://search.cpan.org/~lichtkind/Kephra-0.4.0_4/
crossplatform, GUI-Texteditor along perllike Paradigms 
----
LWP-Curl-0.05
http://search.cpan.org/~lorn/LWP-Curl-0.05/
LWP methods implementation with Curl engine 
----
Language-Functional-0.04
http://search.cpan.org/~lbrocard/Language-Functional-0.04/
a module which makes Perl slightly more functional 
----
Log-Fine-0.21
http://search.cpan.org/~cfuhrman/Log-Fine-0.21/
Yet another logging framework 
----
Mail-Log-Parse-1.0210
http://search.cpan.org/~dstaal/Mail-Log-Parse-1.0210/
Parse and return info in maillogs 
----
MooseX-Meta-Attribute-Lvalue-0.04
http://search.cpan.org/~ctbrown/MooseX-Meta-Attribute-Lvalue-0.04/
Immplements lvalue attributes via meta-attribute trait 
----
MooseX-Object-Pluggable-0.0009
http://search.cpan.org/~groditi/MooseX-Object-Pluggable-0.0009/
Make your classes pluggable 
----
NetApp-1.1.2
http://search.cpan.org/~wpmoore/NetApp-1.1.2/
----
Parse-ErrorString-Perl-0.01
http://search.cpan.org/~pshangov/Parse-ErrorString-Perl-0.01/
Parse error messages from the perl interpreter 
----
Parse-Marpa-0.221_001
http://search.cpan.org/~jkegl/Parse-Marpa-0.221_001/
Generate Parsers from any BNF grammar 
----
Perl-Critic-1.093_03
http://search.cpan.org/~elliotjs/Perl-Critic-1.093_03/
Critique Perl source code for best-practices. 
----
Protocol-Modbus-0.05
http://search.cpan.org/~cosimo/Protocol-Modbus-0.05/
Implements Modbus protocol message generation and parsing 
----
Rose-DB-0.749
http://search.cpan.org/~jsiracusa/Rose-DB-0.749/
A DBI wrapper and abstraction layer. 
----
Rose-DB-Object-0.777
http://search.cpan.org/~jsiracusa/Rose-DB-Object-0.777/
Extensible, high performance object-relational mapper (ORM). 
----
Rose-DBx-Object-Cached-FastMmap-0.02
http://search.cpan.org/~kmcgrath/Rose-DBx-Object-Cached-FastMmap-0.02/
Rose::DB::Object Cache Cache::FastMmap 
----
ShipIt-Step-Twitter-0.05
http://search.cpan.org/~marcel/ShipIt-Step-Twitter-0.05/
ShipIt step to announce the upload on Twitter 
----
Spreadsheet-XLSX-0.05
http://search.cpan.org/~dmow/Spreadsheet-XLSX-0.05/
Perl extension for reading MS Excel 2007 files; 
----
Storable-AMF-0.27
http://search.cpan.org/~grian/Storable-AMF-0.27/
Perl extension for serialize/deserialize AMF0/AMF3 data 
----
Syntax-Highlight-Perl6-0.01_01
http://search.cpan.org/~azawawi/Syntax-Highlight-Perl6-0.01_01/
Perl 6 syntax highlighter 
----
Syntax-Highlight-Perl6-0.02
http://search.cpan.org/~azawawi/Syntax-Highlight-Perl6-0.02/
Perl 6 syntax highlighter 
----
Syntax-Highlight-Perl6-0.021
http://search.cpan.org/~azawawi/Syntax-Highlight-Perl6-0.021/
Perl 6 syntax highlighter 
----
Syntax-Highlight-Perl6-0.022
http://search.cpan.org/~azawawi/Syntax-Highlight-Perl6-0.022/
Perl 6 syntax highlighter 
----
Task-Kensho-0.0.5
http://search.cpan.org/~perigrin/Task-Kensho-0.0.5/
A Glimpse at an Enlightened Perl 
----
Task-Kensho-0.0.6
http://search.cpan.org/~perigrin/Task-Kensho-0.0.6/
A Glimpse at an Enlightened Perl 
----
Task-Kensho-0.0.7
http://search.cpan.org/~perigrin/Task-Kensho-0.0.7/
A Glimpse at an Enlightened Perl 
----
Test-Assert-0.03
http://search.cpan.org/~dexter/Test-Assert-0.03/
Assertion methods for those who like JUnit. 
----
Test-Usage-0.07_50
http://search.cpan.org/~lucs/Test-Usage-0.07_50/
A different approach to testing: selective, quieter, colorful. 
----
Toolset-Bundle-0.1
http://search.cpan.org/~jpierce/Toolset-Bundle-0.1/
----
WWW-Google-Time-0.0102
http://search.cpan.org/~zoffix/WWW-Google-Time-0.0102/
get time for various locations via Google 
----
XML-Trivial-0.06
http://search.cpan.org/~pajout/XML-Trivial-0.06/
The trivial tool representing parsed XML as tree of read only objects. 


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/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


------------------------------

Date: Fri, 12 Dec 2008 18:22:21 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Try to exit inner loop and start next iteration of outter loop.
Message-Id: <x7skotj7wy.fsf@stemsystems.com>

>>>>> "JE" == Jürgen Exner <jurgenex@hotmail.com> writes:

two things:

  JE> Just change this line to 

  JE> 	while (my $current_line = <SSH> and $count < 5) {

a guideline i use (and stole from peter scott) is to use the word
booleans (and/or) when doing flow control and the symbolic ones (||, &&)
when doing expressions. their different precedence works better when
they are used that way. the above case is an odd one for that rule as
the binding is better with and (= binds tighter) but it is more of an
expression. as i said, it is a

  JE> and you can get rid of those stupid labels.

yes. labels should only be needed in special cases. perl rarely needs
labels and i barely ever use them.  they should only be used when
nothing else works well.

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: Fri, 12 Dec 2008 16:20:43 -0800
From: "John W. Krahn" <someone@example.com>
Subject: Re: Try to exit inner loop and start next iteration of outter loop.
Message-Id: <tdD0l.911$E46.270@newsfe21.iad>

J=FCrgen Exner wrote:
> Nene <rodbass63@gmail.com> wrote:
>>
>> What I'm trying to do is once my inner loop reaches a count of 5, I
>> want it to exit the while statement and go back to the foreach loop.
>> But it hangs after it reaches '5' and takes a long time for it go to
>> to the second iteration (really large files) of the for foreach loop:
>>
>> #!/usr/bin/perl -w
>> use strict;
>>
>> my @LIST =3D qw/
>> server_1
>> server_2
>> /;
>>
>> my $count =3D 0;
>>
>> FIRST: foreach my $SERVER (@LIST)  {
>>
>> my $ssh =3D "ssh $SERVER";
>> my $cmd =3D "perl -ne 'print' /server/directory/file";
>>
>>
>> open(SSH, "$ssh $cmd |") || die "ssh: $!";
>>
>> print "\n";
>> print "Connected to $SERVER\n";
>>
>>
>> LINE: while (my $current_line =3D <SSH>) {
>=20
> Just change this line to=20
>=20
> 	while (my $current_line =3D <SSH> and $count < 5) {

You would have to change that to:

	while ( defined( my $current_line =3D <SSH> ) and $count < 5 ) {

In case <SSH> returned "0".



John
--=20
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov


------------------------------

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 2053
***************************************


home help back first fref pref prev next nref lref last post