[25113] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7363 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 5 11:05:46 2004

Date: Fri, 5 Nov 2004 08:05:11 -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           Fri, 5 Nov 2004     Volume: 10 Number: 7363

Today's topics:
        Array -> Reference to Hash of Arrays (Tom)
    Re: Array -> Reference to Hash of Arrays <bmb@ginger.libs.uga.edu>
    Re: Check POP3 E-mail (krakle)
    Re: Check POP3 E-mail (krakle)
    Re: Check POP3 E-mail <noreply@gunnar.cc>
    Re: DEFINEs in Perl? <do-not-use@invalid.net>
    Re: DEFINEs in Perl? <nospam@nospam.com>
    Re: DEFINEs in Perl? <bik.mido@tiscalinet.it>
    Re: DEFINEs in Perl? <nospam@nospam.com>
    Re: EOF issue <onedoesnot@needto.know>
    Re: EOF issue <tadmc@augustmail.com>
    Re: EOF issue <jwillmore@adelphia.net>
    Re: EOF issue <jwillmore@adelphia.net>
    Re: EOF issue <ThomasKratz@REMOVEwebCAPS.de>
    Re: EOF issue <peter@semantico.com>
    Re: EOF issue <jwillmore@adelphia.net>
    Re: EOF issue <uri@stemsystems.com>
    Re: EOF issue <onedoesnot@needto.know>
        Finding consecutive lines (Peter)
    Re: Generating postscript file <scobloke2@infotop.co.uk>
    Re: map()'s BLOCK [was: "Re: Q: re Inline and Benchmark <bik.mido@tiscalinet.it>
        perl  win32 & output of printf  <vp@yahoo.com>
    Re: Regex for all word "boundaries" (was: FAQ 6.17: Why <tadmc@augustmail.com>
    Re: Rlogin client? <jll@soundobjectlogic.com>
    Re: Rlogin client? <vek@station02.ohout.pharmapartners.nl>
    Re: Spurious "Use of uninitialized value" with -w, redu <dejanews@email.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 5 Nov 2004 07:04:59 -0800
From: sudhirx@gmail.com (Tom)
Subject: Array -> Reference to Hash of Arrays
Message-Id: <f50c52fa.0411050704.7b3cf7c9@posting.google.com>

Hope my subject is right !
Well, Here is what 'm trying to fight with

How to create/add/delete/print an "Array which Refers to Hash of
Arrays"

Array - List of test cases  (Not-Unique)
Hash  - Key: Test Case Iteration #   (Unique)
        Value: <More than one value> i.e Array

E.g. One test case(ARRAY-ELEMENT) shall have more than one iterations
(HASH-KEY) and iteration results (HASH-VALUE). I'm fiddling with perl
datastructures on how to implement this.

Let me know if this needs more explanation !


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

Date: Fri, 5 Nov 2004 10:47:45 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Array -> Reference to Hash of Arrays
Message-Id: <Pine.A41.4.58.0411051042420.41890@ginger.libs.uga.edu>

On Fri, 5 Nov 2004, Tom wrote:

> Hope my subject is right !
> Well, Here is what 'm trying to fight with
>
> How to create/add/delete/print an "Array which Refers to Hash of
> Arrays"
>
> Array - List of test cases  (Not-Unique)
> Hash  - Key: Test Case Iteration #   (Unique)
>         Value: <More than one value> i.e Array
>
> E.g. One test case(ARRAY-ELEMENT) shall have more than one iterations
> (HASH-KEY) and iteration results (HASH-VALUE). I'm fiddling with perl
> datastructures on how to implement this.
>
> Let me know if this needs more explanation !
>

And you've read "perldoc perldsc" sections "HASHES OF ARRAYS" and "ARRAYS
OF HASHES" and you're not sure how to put them together?  What have you
tried so far?

Regards,

Brad


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

Date: 5 Nov 2004 06:43:04 -0800
From: krakle@visto.com (krakle)
Subject: Re: Check POP3 E-mail
Message-Id: <237aaff8.0411050643.56e045a0@posting.google.com>

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message news:<Xns959648CF2E86asu1cornelledu@132.236.56.8>...
> krakle@visto.com (krakle) wrote in
> news:237aaff8.0411022258.4b37ab88@posting.google.com: 
> 
> > "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> > news:<Xns9595BC995A87asu1cornelledu@132.236.56.8>... 
> 
> ...
> 
> >> There is no need to explictly initialize my variables.
> > 
> > How about for resetting purposes in mod_perl?
> 
> Care to show what you mean by giving us some code?
> 
> Please note that I have a pretty good idea what you might be referring to, 
> but it is your job to actually _make_ an argument (using code, since this 
> is a programming newsgroup) for the point you are trying to make.

It was a question I made, not a point. I'm not trying to _make_ an
arguement. mod_perl scripts stay in memory. Unless you reset the
values of a variable at the beginning of the script or before that
variable is used it may contain the previous users data...


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

Date: 5 Nov 2004 06:55:21 -0800
From: krakle@visto.com (krakle)
Subject: Re: Check POP3 E-mail
Message-Id: <237aaff8.0411050655.54ff5153@posting.google.com>

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message news:<Xns959648CF2E86asu1cornelledu@132.236.56.8>...
> krakle@visto.com (krakle) wrote in
> news:237aaff8.0411022258.4b37ab88@posting.google.com: 
> 
> > "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> > news:<Xns9595BC995A87asu1cornelledu@132.236.56.8>... 
> 
> ...
> 
> >> There is no need to explictly initialize my variables.
> > 
> > How about for resetting purposes in mod_perl?
> 
> Care to show what you mean by giving us some code?
> 
> Please note that I have a pretty good idea what you might be referring to, 
> but it is your job to actually _make_ an argument (using code, since this 
> is a programming newsgroup) for the point you are trying to make.

Since you insist on seeing code for whatever unknown reason before you
answer my question (ignorance). I'll show you some...

_WITHOUT resetting variable_

use CGI;
my $cgi = new CGI;

my @message;

if (some_other_yada) {
   push (@message, "This is message #1: $cgi->param('msg1')");
}

if (some_other_yada) {
   push (@message, "Now this is message 2: $cgi->param('msg2')");
}

if (@message) {
   foreach (@message) { print "$_\n" }
} else {
    print "No messages";
}

If ran as a CGI everything works fine... HOWEVER, if ran as mod_perl
@message retains the previous users data then the new users data adds
to the array then the next users data will retain the last 2 users and
so on... So Even if the current users session never had any "messages"
to add @message will not be empty. BUT if you used

my @message = ();

just like the original poster used the array woudl be reset at the
start of the script emptying any data left over from the previous
session.


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

Date: Fri, 05 Nov 2004 16:19:22 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Check POP3 E-mail
Message-Id: <2v1k72F2ev3dmU1@uni-berlin.de>

krakle wrote:
> "A. Sinan Unur" wrote:
>> krakle@visto.com (krakle) wrote:
>>> 
>>> How about for resetting purposes in mod_perl?
>> 
>> Care to show what you mean by giving us some code?
>> 
>> Please note that I have a pretty good idea what you might be
>> referring to, but it is your job to actually _make_ an argument
>> (using code, since this is a programming newsgroup) for the point
>> you are trying to make.
> 
> Since you insist on seeing code for whatever unknown reason before
> you answer my question (ignorance). I'll show you some...
> 
> _WITHOUT resetting variable_
> 
> use CGI;
> my $cgi = new CGI;
> 
> my @message;
> 
> if (some_other_yada) {
>    push (@message, "This is message #1: $cgi->param('msg1')");
> }
> 
> if (some_other_yada) {
>    push (@message, "Now this is message 2: $cgi->param('msg2')");
> }
> 
> if (@message) {
>    foreach (@message) { print "$_\n" }
> } else {
>     print "No messages";
> }

Did you run that code? Apparently not, since it doesn't even compile
(under strict). Consequently, it does not serve the purpose of
illustrating anything.

> If ran as a CGI everything works fine... HOWEVER, if ran as mod_perl
> @message retains the previous users data then the new users data adds
> to the array then the next users data will retain the last 2 users
> and so on... So Even if the current users session never had any
> "messages" to add @message will not be empty. BUT if you used
> 
> my @message = ();
> 
> just like the original poster used the array woudl be reset at the
> start of the script emptying any data left over from the previous
> session.

As I explained in another message in this thread, your theory is
incorrect, and if you had written real code and run it, you'd have found
out for yourself.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 05 Nov 2004 15:47:36 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: DEFINEs in Perl?
Message-Id: <yzdy8hgwdx3.fsf@invalid.net>


"Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de> writes:
> Also sprach Arndt Jonasson:
> > What Perl does with a regular expression just before using it for
> > matching (or just once, if /o is used) is called compilation, too.
> 
> It's a different kind of compilation as a pattern isn't compiled into an
> op. Instead, the pattern is prepared into something the regular
> expression understands when the match-op is due.

Yes, the target languages of the compilation are different.

(Historical note: the original implementation language of Emacs, TECO,
did compile search patterns into machine code on the fly.)



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

Date: Fri, 5 Nov 2004 10:29:26 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: DEFINEs in Perl?
Message-Id: <1099668625.475797@nntp.acecape.com>

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:cmfjor$cfq$1@mamenchi.zrz.TU-Berlin.DE...
>     my %action = (
>         do_this => sub {
>                 # do this
>             },
>         do_that => sub {
>                 # do that
>             },
>         other_thing => sub {
>                 # do other thing
>             },
>     );


hey anno, yeah, i put psuedo-code, but only beause it was so spread out, and
figured it would be hard to read otherwise, so essentialy you are seeing the
actual code, just renamed..

actually everyone understood  it was instead of using 1, 2, 3, to use
predefined constant's...it is all about when compiled, cause with C, the
contsants(#defines) are replaced at compilation, and that's it, your actual
machine code would on an if statement compare a 1 to 1 or to a 2.....

 ....i see how you say to do it, but have to wonder, when using a KEY, isn't
there still a string compare happening behind the scenes?    and when it
comes to that, am no assembly code expert but, comparing a 1 to a 2 is far
quicker than comparing "cat" to "catch"




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

Date: Fri, 05 Nov 2004 16:41:32 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: DEFINEs in Perl?
Message-Id: <k41no09hkutrj4ddee9vf3s4k7ag38oahn@4ax.com>

On 05 Nov 2004 10:54:31 +0100, Arndt Jonasson <do-not-use@invalid.net>
wrote:

>Non-Perlish suggestion: if you find you can't do this within Perl, you
>you can maybe use an external macro processor to preprocess the Perl
>source code. Two that come to mind are the C preprocessor, and the
                                            ^^^^^^^^^^^^^^
                                            ^^^^^^^^^^^^^^

But that could be suboptimal or even a real PITA, for obvious reasons.
See also the note about -P in 'perldoc perlrun'.


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: Fri, 5 Nov 2004 10:43:05 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: DEFINEs in Perl?
Message-Id: <1099669443.820233@nntp.acecape.com>

"Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de> wrote in message
news:slrncom58a.pp.tassilo.von.parseval@localhost.localdomain...

AND TO EVERYONE ELSE WHO REPLIED BACK...

thanks....

tassilo, pretty much JUST woke up, we all know those late night coding
sessions...i believe i understand what you are saying, will take me some
time to digest and read properly....


thanks again to everyone who took the time to reply




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

Date: Fri, 5 Nov 2004 14:01:53 -0000
From: "IanW" <onedoesnot@needto.know>
Subject: Re: EOF issue
Message-Id: <cmg1su$svc$1@blackmamba.itd.rl.ac.uk>

"Peter Wyzl" <wyzelli@yahoo.com> wrote in message
news:_kLid.15873$K7.1192@news-server.bigpond.net.au...
[..]
> > So after opening the file (FH), I while-loop through it like this:
> >
> > my @chunk = ();
> > while(my $ln = <FH>){
> >        if(($ln =~ /^={15}$/ or eof) and scalar @chunk > 0){
> >                # process @chunk
> >                undef @chunk;
> >        }
> >        push(@chunk,$ln);
> > }
> >
> > That works nicely except that when it gets to the end of the file "Line
3"
> > above is not added to @chunk. I would have expected eof to test positive
> > when it gets to the end of the blank line. Am I missing something
obvious
> > here or is there a quirk with the usage of eof?
>
[..]
>
> BTW, your problem is that the while loop encounters the eof and self
> terminates therefore your test never happens.  Part of the magic of the
>
> while (<FH>){

Doh, of course. One oddity remains though.. In my original code I had this:

if($ln =~ /^={15}$/ and scalar @chunk > 0){

instead of the revised:

if(($ln =~ /^={15}$/ or eof) and scalar @chunk > 0){

without the eof test the whole last chunk (from = x 15 to the blank line at
the end of the file, inclusive) was skipped, because of course it was
looking for another line of ='s before processing the chunk. However, with
the eof test, it does actually process the last chunk, except misses off the
"Line 3". Any ideas on that?

IanW



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

Date: Fri, 5 Nov 2004 08:06:37 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: EOF issue
Message-Id: <slrncon27d.glk.tadmc@magna.augustmail.com>

Graham Wood <Graham.T.removethis.Wood@oracle.andthis.com> wrote:
> IanW wrote:


[ snip: code for building multiline records ]


>> That works nicely except that when it gets to the end of the file "Line 3"
>> above is not added to @chunk.


> Your problem is that your while loop exits when it hits eof and 
> therefore you never hit the if statement when eof is true.


> Someone will doubtless suggest a more elegant solution.


OK, how's this (untested)?


   {
      local $/ = "===============\n";
      push @chunk, $_ while <FILE>;
      chomp @chunk;                    # chomp() knows what to remove too!
   }


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 05 Nov 2004 09:25:56 -0500
From: James Willmore <jwillmore@adelphia.net>
Subject: Re: EOF issue
Message-Id: <wOqdnX2GUJ78EBbcRVn-qg@adelphia.com>

IanW wrote:
> I'm looping through each line of a text file, with a format like this:
> 
> # start of file
> ===============
> Line 1
> Line 2
> Line 3
> ===============
> Line 1
> Line 2
> Line 3
> ===============
> Line 1
> Line 2
> Line 3
> 
> # end of file
> 
> I am processing it in chunks where "===============" is the start of each
> chunk.
> 
> So after opening the file (FH), I while-loop through it like this:
> 
> my @chunk = ();
> while(my $ln = <FH>){
>         if(($ln =~ /^={15}$/ or eof) and scalar @chunk > 0){
>                 # process @chunk
>                 undef @chunk;
>         }
>         push(@chunk,$ln);
> }
> 
> That works nicely except that when it gets to the end of the file "Line 3"
> above is not added to @chunk. I would have expected eof to test positive
> when it gets to the end of the blank line. Am I missing something obvious
> here or is there a quirk with the usage of eof?

Try:

#!/usr/bin/perl

use strict;
use warnings;

open(IN, 'sample')
   or die "Can't open sample: $!\n";

my @chunk;
while(<IN>) {
   chomp;
   next if /^={15}$/ or length $_ == 0;
   push @chunk, $_;
}

close IN;

print join("\n", @chunk),"\n";

I ditched the $in variable - I just operated on "$_".  I also 
changed the logic you used to test for a valid line (from 'and' to 
'or').  I also chomp'ed the line - which causes the length of an 
"empty" line to go to zero (which helps if you're testing the length 
of the line - newlines and carriage returns do have length AFAIK ... 
but I could be wrong on this point).

HTH

Jim


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

Date: Fri, 05 Nov 2004 09:47:09 -0500
From: James Willmore <jwillmore@adelphia.net>
Subject: Re: EOF issue
Message-Id: <Bvednesc1-bHDxbcRVn-vg@adelphia.com>

Peter Hickman wrote:
<snip>
> my @chunk = ();
> while(my $ln = <FH>){
>         if($ln =~ /^={15}$/){

Where, in your example, have you actually assigned a value to 
@chunk?  I see $in, but nothing related to @chunk.  Not enough 
coffee yet ... maybe ;-)

>                 process( @chunk ) if @chunk;
>                 undef @chunk;
>         }
>         push(@chunk,$ln);
> }
> process( @chunk ) if @chunk;
> 
> eof is rarely used, in my experience.

True.  Same here.

Jim


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

Date: Fri, 05 Nov 2004 15:52:19 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: EOF issue
Message-Id: <418b939f$0$17108$bb690d87@news.main-rheiner.de>

IanW wrote:
> "Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote
>>
>>You can try playing with the $/ variable. See "perldoc perlvar".
> 
> Well, yes, I could split the file into chunks with something like this:
> 
> open(FH,$file);
> local $/;
> $lines = <FH>;
> close(FH);
> @chunks = $lines =~ /={15}.+?(?=\={15}|$)/g;
> foreach(@chunk){
>         # process chunk
> }
> 

I think Gunnar meant something like:

{
    local $/ = '=' x 15 . "\n";
    while ( my $chunk = <FH> ) {
       chomp($chunk);
       next unless $chunk =~ /\w/;
       # process chunk
    }
}

Why separate the chunks yourself, when <> and chomp, in combination with 
$/ can do the job?

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: Fri, 05 Nov 2004 14:59:17 +0000
From: Peter Hickman <peter@semantico.com>
Subject: Re: EOF issue
Message-Id: <418b9545$0$2356$afc38c87@news.easynet.co.uk>

James Willmore wrote:
> Where, in your example, have you actually assigned a value to @chunk?  I 
> see $in, but nothing related to @chunk.  Not enough coffee yet ... maybe 
> ;-)

Perhaps the push?


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

Date: Fri, 05 Nov 2004 10:12:06 -0500
From: James Willmore <jwillmore@adelphia.net>
Subject: Re: EOF issue
Message-Id: <P7GdnYA5NbyuBRbcRVn-pw@adelphia.com>

Peter Hickman wrote:
> James Willmore wrote:
> 
>> Where, in your example, have you actually assigned a value to @chunk?  
>> I see $in, but nothing related to @chunk.  Not enough coffee yet ... 
>> maybe ;-)
> 
> 
> Perhaps the push?

Ah, I see it now.  You did the reverse of what I would have done.

I guess I'll grab another cup myself :-)


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

Date: Fri, 05 Nov 2004 15:31:31 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: EOF issue
Message-Id: <x7pt2s48j0.fsf@mail.sysarch.com>

>>>>> "PW" == Peter Wyzl <wyzelli@yahoo.com> writes:

  PW> default.
  PW> {
  PW>     local $/ = ''; #slurp mode

that is paragraph mode. undef is the value for slurp mode.
and File::Slurp is faster and a nicer API IMO :).

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Fri, 5 Nov 2004 15:55:57 -0000
From: "IanW" <onedoesnot@needto.know>
Subject: Re: EOF issue
Message-Id: <cmg8is$vm4$1@blackmamba.itd.rl.ac.uk>

"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrncon27d.glk.tadmc@magna.augustmail.com...
[..]
>    {
>       local $/ = "===============\n";
>       push @chunk, $_ while <FILE>;
>       chomp @chunk;                    # chomp() knows what to remove too!
>    }

where would one process each chunk in that - it seems to just slurp every
line of the file into @chunk except the "=" x 15 ones?

IanW



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

Date: 5 Nov 2004 06:46:16 -0800
From: peter_holmes2003@yahoo.com (Peter)
Subject: Finding consecutive lines
Message-Id: <9e41635d.0411050646.2a5e25@posting.google.com>

I need to parse a file looking for patterns in 5 consecutive lines.
e.g.

I want to find 5 consecutive lines with "abc" in first line, "def" in second,
"efg" in third etc. 

How can I do something like this..


Thanks in advance,
Peter


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

Date: Fri, 5 Nov 2004 14:07:31 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Generating postscript file
Message-Id: <cmg1f2$rtp$1@sparta.btinternet.com>

BCC wrote:

> Does anyone know of a perl module like GD that will allow me to draw 
> with colors and shapes and save it as a postscript file?  GD doesnt give 
> me that option unfortunately.
> 
> Looked in CPAN and didnt see anything.
> 
> Thanks

#!/bin/perl
use warnings;
use strict;

my $text='Why not learn Postscript?';

print <<ENDPS;
%!PS
%
% define a handy subroutine to scale units
%
/inch { 72 mul } def
%
% draw a blue rectangle
%
0 0 1 setrgbcolor
1 inch 8 inch moveto
6 inch 8 inch lineto
6 inch 9 inch lineto
1 inch 9 inch lineto
closepath
fill
%
% write some text
%
1.8 inch 8.4 inch moveto
/Helvetica findfont 22 scalefont setfont
1 setgray
($text) show
%
% emit page
%
showpage
ENDPS


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

Date: Fri, 05 Nov 2004 16:41:31 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: map()'s BLOCK [was: "Re: Q: re Inline and Benchmark"]
Message-Id: <le4no0to9p0o6iu8pem9ppn3imgtqp3sn2@4ax.com>

On 5 Nov 2004 11:43:02 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>The wording of the message is a bit misleading -- the immediate
>environment of "no" is definitely a block, and "no ..." is a statement,
>not part of an expression.  I think I'll be able to live with it...

Well, I guess I can live with it too. Especially since I had never
even noticed up until now! However, out of curiosity: do you think
that it "ought" to be allowed, hypothetically speaking?


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: Fri, 05 Nov 2004 15:15:34 +0100
From: vp <vp@yahoo.com>
Subject: perl  win32 & output of printf 
Message-Id: <418b8a6c$0$2989$ba620e4c@news.skynet.be>

Hi all,
In Perl win32 (ActivePerl v5.8.3), when I use

printf "%8d %15.6E\n", $x, $y;

I got always:

   100207  -8.000000E+002

With the same script, under Linux & HP-UX, I got:

   100207  -8.000000E+02

How I could tell Perl win32 that I need only two numbers for exposant (E+02 instead of E+002) ?

Thank you,
Regards,


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

Date: Fri, 5 Nov 2004 08:19:23 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Regex for all word "boundaries" (was: FAQ 6.17: Why don't word-boundary searches with "\b" work for me?)
Message-Id: <slrncon2vb.go2.tadmc@magna.augustmail.com>

Jeff Boes <jboes@qtm.net> wrote:
> At some point in time, PerlFAQ Server <comdog@panix.com> wrote:
> 
>>6.17: Why don't word-boundary searches with "\b" work for me?


> I.e., I need to find the points at which the string transits from being "In a
> word" to being "Not in a word" and vice-versa; this includes the point just
> before the first word-like character -- which may or may not be the first
> character of the string -- and the point just after the last word-like character
> -- again, could be the last character, or maybe not.
> 
> Any elegant ways to do this? 


   \b\w+\b


> (?:^|\b)\w+(?:\b|$)


From perlre.pod:

   A word boundary (C<\b>) is a spot between two characters
   that has a C<\w> on one side of it and a C<\W> on the other side
   of it (in either order), counting the imaginary characters off the
   beginning and end of the string as matching a C<\W>.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 05 Nov 2004 14:39:56 GMT
From: Jean-Louis Leroy <jll@soundobjectlogic.com>
Subject: Re: Rlogin client?
Message-Id: <lzfz3oiclg.fsf@toots.sol>

> Any reason why
>
>     system rsh => 'user@host', 'command';
>
> wouldn't do the trick?

 ...because I need to run several commands, with side effects (chdir,
change env vars). I'm writing a test suite for some command-line tool
and I want to emulate the real usage pattern.
-- 
Jean-Louis Leroy
Sound Object Logic
http://www.soundobjectlogic.com


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

Date: 05 Nov 2004 15:11:32 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: Rlogin client?
Message-Id: <slrncon613.85m.vek@station02.ohout.pharmapartners.nl>

On Fri, 05 Nov 2004 14:39:56 GMT,
    Jean-Louis Leroy <jll@soundobjectlogic.com> wrote:


>> Any reason why
>>
>>     system rsh => 'user@host', 'command';
>>
>> wouldn't do the trick?
>
> ...because I need to run several commands, with side effects (chdir,
> change env vars). I'm writing a test suite for some command-line tool
> and I want to emulate the real usage pattern.

Pipe the whole list of commands into the shell on the remote system.

open OUT, '|rsh localhost /bin/sh' or die "fail open $!\n";
print OUT <<EOF;
cd /var/tmp
pwd
ls
EOF
close OUT or die "fail close $!, $?\n";


If that isn't good enough then do use Expect, either the Tcl or the
Perl version.


Villy


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

Date: Fri, 05 Nov 2004 15:25:06 GMT
From: samwyse <dejanews@email.com>
Subject: Re: Spurious "Use of uninitialized value" with -w, redux
Message-Id: <mXMid.16212$bP2.11290@newssvr12.news.prodigy.com>

On or about 11/5/2004 7:33 AM, Michele Dondi did proclaim:
> On 4 Nov 2004 15:17:21 -0800, dejanews@email.com (Sam Denton) wrote:
> 
>>OK, my first post had a bug, but it's a real problem, honest.
> 
> [snip]
> 
>>string. Everything works just fine without the '-w' option. Any ideas?
> 
> 
> Well, when I read your post yesterday I was too tired to read your
> actual code, even if you had been sensible enough to quote only the
> relevant lines. Taking this into account I answered the way I did, but
> when I noticed the error you were doing, as pointed out by many people
> here, I regretted having done so. However that *may* still apply,
> though I *recommend* you do that only if you're sure you're not doing
> another mistake like the previous one.

Lines 205-215 were inserted while trying to figure out why I was getting 
the error message; I left them in because they were supposed to show 
that the variable *wasn't* uninitialized.  Unfortunately, one of the 
lines introduced a different mistake that I caught a few seconds after 
posting.  My second posting was an attempt to correct the error, but I 
notice that the first post is still getting responces.  For these errors 
that waste the time of people who are attempting to assist me, I most 
sincerely apologize.

> If the warning is really "spurious", i.e. you *do* know why you're
> getting it, but do not want to hear it anyway, then as I already
> suggested, just locally disable 'uninitialized' warnings.

spurious \SPYUR-ee-uhs\, adjective:
1. Not proceeding from the true or claimed source; not genuine; false.

I call the message "spurious" because it claims that there's an 
uninitialized variable being used in a given statement, but I am unable 
to find one.  That usually indicates a failure on my part, but in this 
case I also am using 'use strict;' and it, too, fails to find anything 
wrong when the '-w' option is removed.  Either there's a very subtl 
problem elsewhere and the message is pointing to the wrong place (in 
which case the first clause of the definition holds), or the message is 
a lie (in which case the last clause holds).

As I previously posted, I will try to reduce the program to something 
smaller that reproduces the error.  This might take a while because the 
program is parsing AIX-specific files and removing the system 
dependencies could be, hmmm, fun.



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

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


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