[13051] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 461 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 11 12:17:19 1999

Date: Wed, 11 Aug 1999 09:10:25 -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, 11 Aug 1999     Volume: 9 Number: 461

Today's topics:
    Re: Optimize Perl programs quest <USENET@questionexchange.com>
        perl5.005_60 : cygwin32 : win95 [No can do.] (Michael R Weholt)
    Re: PLEASE HELP: system call to another perl program... (Michel Dalle)
        printf problem - Left-Justifying Floats pgolds@my-deja.com
    Re: printf problem - Left-Justifying Floats <sariq@texas.net>
    Re: printf problem - Left-Justifying Floats <elaine@chaos.wustl.edu>
    Re: reference to object method (Greg Bacon)
    Re: Regexp newbie (Gary O'Keefe)
    Re: Regexp newbie (Kvan)
    Re: Regexp newbie (Andreas Fehr)
    Re: Regexp newbie (Gary O'Keefe)
    Re: require mylib.pl <USENET@questionexchange.com>
    Re: require mylib.pl (Anno Siegel)
        Reset .. ie clear out a hash array <Nick.Djurovich@btinternet.com>
        Run a script from a web browser and put it in the backg <yoursguideline@hotmail.com>
        Running Scripts in Telnet (Win32) <kkuebler@iwaynet.net>
    Re: Scalar context? <bivey@teamdev.com>
    Re: search and match (Michel Dalle)
    Re: sed vs. grep for string manipulation? (Chirag Kantharia)
    Re: send perl-users mini-faq <dparrott@ford.com>
    Re: Simple Perl Parsing? <aqumsieh@matrox.com>
    Re: Slight problem with <USENET@questionexchange.com>
    Re: turn $6 into $6000 (Larry Rosler)
    Re: Why use Perl when we've got Python?! <aqumsieh@matrox.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 11 Aug 1999 15:26:11 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Optimize Perl programs quest
Message-Id: <751qx@questionexchange.com>

> Hi!   I usually begin my programs with various variable
> definitions/init's (a habit from C programming) and then begin
> sanity checks and so on. But i wonder if i could optimize my
> program by making variable definitions/init's along the road as
> i need them or do Perl (at compile time) parse the whole file
> anyway?  Mats

Perl parses the whole file and then executes it so moving a
declaration won't help. Note however that you don't need any
declarations at all, if your variables are global (unless you
want to 'use strict'). Of course, if you initialize them to a
value that takes long to calculate and may return from the
function before you use it, then of course it would save time
to move the initialization.   Also, whenever asking whether
something will be faster or slower in Perl, first ask yourself
"does it matter": many optimizations are a lot of effort for a
few hundredths of a second / program run so you'd be using your
time much better otherwise.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2508&cus_id=USENET&qtn_id=1678


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

Date: Wed, 11 Aug 1999 15:52:11 GMT
From: awnbreel@panix.com (Michael R Weholt)
Subject: perl5.005_60 : cygwin32 : win95 [No can do.]
Message-Id: <7os67b$14o_002@news.panix.com>

I've been through this a number of times now.  Things die during 
'make' at the point where I get the message "Installing ld2 into 
/usr/local/bin".  At that point, I get a ton of "=head1: not found" 
messages, then things *really* go to hell.  It seems as if the 'sh 
Configure' command gets reissued (it starts through the Configure 
questions again).  Prior to that, it seems to try to fork everything 
in the joint including me, but fails.  Well, except for me.  I'm 'bout 
done.  The only thing I can do once it starts the Configure questions 
again is Ctrl+C, which totally trashes my machine.  By the time I get 
back in, there is no ld2 anywhere.

But up until that point, things seem to be fine except for during the 
make dependencies section I get a number of "Permission denied" 
warnings wrt types.h, config.h, stddef.h, stdarg.h, ctype.h, stdlib.h 
and so forth.  There may be more; those are just the ones I managed to 
jot down during scroll-by.  Since things seem to proceed fine 
afterward (until ld2), I just took these as warnings I could ignore.  
No?

I am aware of the advice in README.cygwin re: 'make' failing at ld2, 
but the solutions it suggests don't work for me.  For one thing, I can 
never achieve ld2-ness ... so I can't put the thing into any path 
anywhere.  As far as I can tell, ld2 never gets made... or, I believe 
there is a message that pops up after I do the Ctrl+C about 'ld2 being 
deleted'.  But if I don't Ctrl+C it appears I'll be stuck in an 
endless loop.  I did find an ld2.in file (part of the kit, apparently) 
which I tried renaming and putting into the path, just out of 
desperation, you understand, but that didn't seem to make any 
difference.

Is there anybody (anybodies) in here willing to help me get past this 
ld2 jam?  I'm willing to post all the detail you might need (path, 
mount table, etc.) to help you help me diagnose the problem.  I didn't 
want to do it now for fear that I would get yelled at for being in the 
wrong group or something.  This is a perl, problem, of course.  But it 
also is an OS problem, so, I dunno ...

As a start, I'm using gcc 2.95 from the recommended site.  I'm not 
using the egcs version used in README.cygwin because that version's 
Readme says it has been 'obsoleted' by 2.95.  Also, I am using 
cygwin-b20.1.

I'm not very experienced or skilled at this sort of thing.  I'd very 
much appreciate any advice that can get me past this ld2 nightmare.

-- 
 mrw


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

Date: Wed, 11 Aug 1999 14:19:10 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: PLEASE HELP: system call to another perl program...
Message-Id: <7os0u3$oc$1@news.mch.sbs.de>

In article <7oq8et$336$1@nclient15-gui.server.virgin.net>, "Martin Wachters" <GOAWAYSPAMBASTARDSmartin3@dds.nl> wrote:
>Hi all!
>I want to make a system call to another perl program from my perl program.
>This works fine except when I create one of the second program's input files
>in my first program. I even added a sleep statement to try to kludge the
>problem...
[snip]
>
>create_inputfile("inputfile");
>sleep 10;
>system "perlprog2 inputfile @moreargs";
>

Two suggestions for the price of one :

1) do you actually close your file in the create_inputfile() sub ?
2) have you tried setting "autoflush" : select(FILE); $| = 1;

>GOAWAYSPAMBASTARDSmartin3@dds.nl
(recipient unknown)

Michel.


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

Date: Wed, 11 Aug 1999 14:40:07 GMT
From: pgolds@my-deja.com
Subject: printf problem - Left-Justifying Floats
Message-Id: <7os205$9r9$1@nnrp1.deja.com>

There seems to be a problem with printf in perl
when attempting to left-justify float values.

The following code:
perl -e 'printf "|%-10.4f|\n",0;'

results in:
|    0.0000|

While in Awk:
echo "0" | awk '{printf("|%-10.4f|\n",$0);}'

ksh:
printf "|%-10.4f|\n" 0

and C:
#include <stdio.h>
main()
{
    printf("|%-10.4f|\n",0);
}

The result is:
|0.0000    |

Is this a known bug?  Does anybody have a fix?  We
are using Perl version 5.004_01.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 11 Aug 1999 10:12:41 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: printf problem - Left-Justifying Floats
Message-Id: <37B192E9.F920DE55@texas.net>

pgolds@my-deja.com wrote:
> 
> There seems to be a problem with printf in perl
> when attempting to left-justify float values.
> 
> The following code:
> perl -e 'printf "|%-10.4f|\n",0;'
> 
> results in:
> |    0.0000|

On my box:

acme$ perl -e 'printf "|%-10.4f|\n",0;'
|0.0000    |
acme$ perl -v

This is perl, version 5.004_04 built for i686-linux

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the Perl 5.0
source kit.

acme$  

- Tom


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

Date: Wed, 11 Aug 1999 11:26:32 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: printf problem - Left-Justifying Floats
Message-Id: <37B195C3.2EA168EE@chaos.wustl.edu>

pgolds@my-deja.com wrote:
> There seems to be a problem with printf in perl
> when attempting to left-justify float values.
> 
> The following code:
> perl -e 'printf "|%-10.4f|\n",0;'

perl -e 'printf "|%10.4f|\n",0;'
|    0.0000|
 
On my system as expected with the '-'. Hmm. What OS and version of Perl?

e.


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

Date: 11 Aug 1999 15:55:36 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: reference to object method
Message-Id: <7os6do$jv7$1@info2.uah.edu>

In article <7oqp8i$ioe$1@towncrier.cc.monash.edu.au>,
	damian@cs.monash.edu.au (Damian Conway) writes:
: Note that you can also use symbolic references and write:
: 
:      my $ref = "Bar::FooOnYou";   
:      $var->$ref("Howdy\n");   
: 
: But you didn't hear that from me ;-)

I've used this construct for a while, but I've never thought of it as
being a symbolic reference.  The following program runs happily, so do
we have a hole in C<use strict 'refs'>?

    #! /usr/bin/perl -w

    use strict;

    package Foo;

    sub new {
        my $class = shift;
        my $self  = [];

        bless $self => $class;
    }

    sub bar {
        my $self = shift;

        print "Where's the beer, $self?\n";
    }

    package main;

    my $foo = Foo->new;
    my $meth = "bar";

    $foo->$meth();

I'm inclined to think of $obj->$var() as a dynamic method call, but
maybe I'm just trying to define away the problem. :-)

Greg
-- 
If you can't beat your computer at chess, try kickboxing.


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

Date: Wed, 11 Aug 1999 14:13:27 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: Regexp newbie
Message-Id: <37b177bb.84229199@news.hydro.co.uk>

Erich Seifert wrote:

>Hi,
>
>My problem: I'm not very familiar with regular expressions, but I want
>to replace each of the leading spaces in a string with another string.

Gosh. Not familiar, eh? If only you had an a set of online
documentation that contained references and tutorials on how to use
these funny buggers. Darn, darn, darn. If only such a set of
documentation had been bundled with your perl distributution, then you
could look at that instead of posting to the newsgroup. It would
certainly prevent the inevitable embarrassment at being told how
pathetic and miserable a luser you are, and asked why didn't you just
look in the perlre documentation in the first place. The other readers
of this newsgroup couldn't possibly know that you didn't have this
documentation available. What a shame it is to be misunderstood...

Read the documentation that came with perl.

>Who can help me?

If Abigail gets her hands on you, not even God can help you.

Try this:

#!/usr/local/bin/perl -w

use strict;

my $string = '     - I am a luser.';
my $replace = 'Luser ';

while ($string =~ /^ +/) {$string =~ s/( *) (\S*.*)/$1$replace$2/;}
print $string . "\n";

HTH

Gary
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


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

Date: Wed, 11 Aug 1999 12:45:12 GMT
From: kvan@dis.dk (Kvan)
Subject: Re: Regexp newbie
Message-Id: <37b16fdf.93593961@news.newsguy.com>

On Wed, 11 Aug 1999 14:22:33 +0200, Erich Seifert
<erich.seifert@dachau.baynet.de> wrote:

>My problem: I'm not very familiar with regular expressions, but I want
>to replace each of the leading spaces in a string with another string.
>Who can help me?

Jeffrey Friedl can definitely help you, if you read his book
"Mastering Regular Expressions" (O'Reilly). The Perl documentation can
also help you, if you do a:

perldoc perlre

By the way, the solution to this particular problem is
s/^(\s*)/$string/.

Kvan.

-------Casper Kvan Clausen------ | 'A *person* is smart. People are
---------<kvan@dis.dk>---------- |  dumb, panicky, dangerous animals
                                 |  and you know it.'
                                 |        - "K" in Men in Black.


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

Date: Wed, 11 Aug 1999 15:04:43 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: Regexp newbie
Message-Id: <37b18f44.2379241@news.uniplus.ch>

On Wed, 11 Aug 1999 12:45:12 GMT, kvan@dis.dk (Kvan) wrote:

>>My problem: I'm not very familiar with regular expressions, but I want
>>to replace each of the leading spaces in a string with another string.
>>Who can help me?
>
>Jeffrey Friedl can definitely help you, if you read his book
>"Mastering Regular Expressions" (O'Reilly). The Perl documentation can
>also help you, if you do a:
>
>perldoc perlre
>
>By the way, the solution to this particular problem is

No.

>s/^(\s*)/$string/.

I'm sure Jeffrey Friedl gave a _working_ sollution in his book.

Test your code and read 'perldoc -q space':

Found in perlfaq4.pod
  How do I strip blank space from the beginning/end of a string?

            Although the simplest approach would seem to be:

                $string =~ s/^\s*(.*?)\s*$/$1/;

            This is unnecessarily slow, destructive, and fails with
            embedded newlines. It is much better faster to do this
            in two steps:

                $string =~ s/^\s+//;
                $string =~ s/\s+$//;

            Or more nicely written as:

                for ($string) {
                    s/^\s+//;
                    s/\s+$//;
                }

            This idiom takes advantage of the `foreach' loop's
            aliasing behavior to factor out common code. You can do
            this on several strings at once, or arrays, or even the
            values of a hash if you use a slide:

                # trim whitespace in the scalar, the array,
                # and all the values in the hash
                foreach ($scalar, @array, @hash{keys %hash}) {
                    s/^\s+//;
                    s/\s+$//;
                }
<cut>

Andreas


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

Date: Wed, 11 Aug 1999 15:37:14 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: Regexp newbie
Message-Id: <37b19764.92335403@news.hydro.co.uk>

A keyboard was smashed into Gary O'Keefe's face and out came:

[ Eric's stuff snipped - it was boring anyway ]

>#!/usr/local/bin/perl -w
>
>use strict;
>
>my $string = '     - I am a luser.';
>my $replace = 'Luser ';
>
>while ($string =~ /^ +/) {$string =~ s/( *) (\S*.*)/$1$replace$2/;}
                                              ^^
should be

while ($string =~ /^ +/) {$string =~ s/( *) ([^ ]*.*)/$1$replace$2/;}

to be strictly correct with the problem definition.

>print $string . "\n";

This is a nasty, brute force method. Can anyone think of a more
elegant solution?

Gary
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


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

Date: 11 Aug 1999 15:25:33 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: require mylib.pl
Message-Id: <748qx@questionexchange.com>

> The perl cookbook would lead me to believe that perhaps I
> should learn how  to write a module because the notion of
> libraries is quickly becoming obsolete, however, all I want to
> do is store a mass of strings...  const.pl:    $const_str1 =
> 'this is string1';    $const_str2 = 'this is string2';     1;
> #// const.pl  mytest.pl    #!/usr/bin/perl -w     require
> 'const.pl';     print "$const_str1\n";    print
> "$const_str2\n";  #// mytest.pl  Now, if there is anything that
> I have learned from reading this group it is that you must use
> the -w flag. So I use said flag and the following output is
> sent to stderr accordingly:  Name "main::const_str1" used only
> once: possible typo at ./mytest.pl line 5. Name
> "main::const_str2" used only once: possible typo at ./mytest.pl
> line 6.  My question is then: Is there a better way to define a
> file of (50-60) constant strings, that is used across several
> scripts, or should I ignore the previous lines?  Thanks

First, it is probably better to use 'use' than 'require', since
then the inclusion is done compile-time and you won't get the
same error message. For this, you need to put the library in an
appropriate directory etc - BEGIN { require 'const.pl' } is
also an option.   However, another alternative is to make a
module and put in the constant strings as subs:  sub
const_str1() { "this is string1" }  or also, in the module, you
can do  use constant const_str1 => "this is string1";  In perl,
there is always more than one way to do it.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2507&cus_id=USENET&qtn_id=1662


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

Date: 11 Aug 1999 15:29:40 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: require mylib.pl
Message-Id: <7os4t4$p30$1@lublin.zrz.tu-berlin.de>

QuestionExchange  <USENET@questionexchange.com> wrote, quoting a
nicely formatted posting:

>> The perl cookbook would lead me to believe that perhaps I
>> should learn how  to write a module because the notion of
>> libraries is quickly becoming obsolete, however, all I want to
>> do is store a mass of strings...  const.pl:    $const_str1 =
>> 'this is string1';    $const_str2 = 'this is string2';     1;
>> #// const.pl  mytest.pl    #!/usr/bin/perl -w     require
>> 'const.pl';     print "$const_str1\n";    print
>> "$const_str2\n";  #// mytest.pl  Now, if there is anything that

Eeeek.

Anno


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

Date: Wed, 11 Aug 1999 16:40:47 +0000
From: Nick Djurovich <Nick.Djurovich@btinternet.com>
Subject: Reset .. ie clear out a hash array
Message-Id: <37B1A78F.DBBB4A33@btinternet.com>

Hi,

I have a hash variable structured something like ;

$data{NUMBER_OF_RECORDS}
$data{LIST_OF_RECORDS}
$data{RECORD}{NAME}{<variable>}
$data{RECORD}{NUMBER}{<variable>}
$data{NUMBER_OF_FIELDS}
$data{LIST_OF_FIELDS}
$data{FIELD}{SEPARATOR}
$data{FIELD}{NAME}{<variable>}
 ...
 ..

and so on ..

I want to set up this data in a cyclic loop and need to delete any
previously set data.

How can I reset %data to remove any data ? (both keys and values)
without cycling through *all* the elements.

--
Cheers,

/Nick Djurovich

--

Tel           01273 384 600
E-Mail     mailto:Nick.Djurovich@racalitsec.com
ICQ         11810476
WWW     http://www.racalitsec.com

Racal Security and Payments
Sussex Innovation Centre
Science Park Square
Falmer
Brighton
BN1 9SB
England




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

Date: Wed, 11 Aug 1999 22:31:52 +0800
From: Guideline Chan <yoursguideline@hotmail.com>
Subject: Run a script from a web browser and put it in the background
Message-Id: <37B18958.3266BEB0@hotmail.com>

I want to run a script from a web browser. This script may take 5
minutes to process such as gzip a file. So put this in the background is
preferrable and display the result to the client after finishing.
However the problem is that a web browser is still loading.

How can I stop the browser loading but process the progress in the
background and put the result back to the client after finishing ???

--
thanks



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

Date: Wed, 11 Aug 1999 10:11:12 -0400
From: "Kevin Kuebler" <kkuebler@iwaynet.net>
Subject: Running Scripts in Telnet (Win32)
Message-Id: <7os09n$icm$1@news.iwaynet.net>

Hi all,

I have ActiveState Perl (build 518) running on an NT4 (SP4) server. When I
loaded perl, I checked the option to associate .pl with perl.exe. I can go
to a command prompt, change to a directory with a perl script, and execute
it by simply typing the name of the script file.
    ex: C:\Batch\Bin>test.pl
This will run the test.pl script - no problem. Recently I loaded the telnetd
service from the NT4 resource kit on this server. I can now log into the
machine with a telnet client from my workstation. However, once I log into
the machine with telnet and try to execute a script in the same manner as
above, it doesn't work. The script never runs and I'm returned to the
prompt. But if I invoke the script like this:
    C:\Batch\Bin>perl test.pl
- it runs fine. What's going on here? Is this a problem with perl or with
the telnet service? Any advise would be appreciated.

Thanks,

Kevin Kuebler




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

Date: 11 Aug 1999 14:57:58 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: Scalar context?
Message-Id: <01bee409$a6987340$583c08cf@bill.jump.net>

G. Kuhnert <jkuhnert@harbingercomm.com> wrote in article
<37b17b81.0@news.kivex.com>...
> Where both values should equal "cat"? I don't know why it won't work.
I've
> tried every combination that I can think of to get it, but it just
refuses
> to believe that 'cat' is 'cat'.
> 
 
Are you sure one of them isn't "cat\n"? If it's user input it
should be chomp-ed to remove the line terminator.-Wm


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

Date: Wed, 11 Aug 1999 14:59:21 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: search and match
Message-Id: <7os39c$oc$3@news.mch.sbs.de>

In article <7opk7h$609$1@faatcrl.faa.gov>, "Christian Evans" <chris.evans@tc.faa.gov> wrote:
>i know the following code could be written much simpler, but when i am gone,
>a beginner needs to be able to follow the code structure.
>
[snip]

Thanks for the code, that makes things a bit more clear :-)
Here are some pointers :

> $month_keep = ($months[($mn-1)]);
No need for all the () stuff : 
        $month_keep = $months[$mn-1];
should be enough.

[snip]
> $search_for = ("$month_keep " . "$day");
> $search_for2 = ("$month_keep  " . "$day");
Same remarks about the (). And you don't need to
use . either, since the "..." will already evaluate
everything, so "$month_keep  $day" is enough.

Actually you don't even need those two variables at all
- see below.

> while (<IN_FILE>) {
>  if((/$search_for/) || ($search_for2)) {
>   print "$_">OUT_FILE;
>  }
> }

Here you have a couple of mistakes :

1) $search_for2 is not inside //, so it's always "true"
in this case (but this is probably a typo anyway).

2) As Larry noted, 'Nov 2' will also match 'Nov 23'
for instance. Do you have something like a space
after the day, or is it at the end of the string, ... 
so that you can identify the full date in each line ?

So you could use something like :

        if (/$month_keep  ?$day /) { # notice the space AFTER $day
                ...
        }

3) print "$_" >OUT_FILE; should be rewritten as
        print OUT_FILE $_;
(or even print OUT_FILE; as Eric noted)

Good luck,

Michel.


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

Date: Wed, 11 Aug 1999 11:06:44 GMT
From: dummy@notmyhost.net (Chirag Kantharia)
Subject: Re: sed vs. grep for string manipulation?
Message-Id: <slrn7r2m2v.bnb.dummy@mitra.cse.iitb.ernet.in>

On Sun, 08 Aug 1999 08:34:43 GMT, donturn@my-deja.com wrote:
|    sed -e 's/card*=/replacestring/' lookfile.txt>newfile.txt

This works -

    sed -e 's/card.*=/replacestring/' lookfile.txt>newfile.txt

-- 
Chirag Kantharia <chirag {at} cse.iitb.ernet.in>
Department of Computer Science and Engineering
Indian Institute of Technology, Bombay, India.



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

Date: Wed, 11 Aug 1999 10:03:32 -0400
From: "Dennis M. Parrott" <dparrott@ford.com>
Subject: Re: send perl-users mini-faq
Message-Id: <37B182B4.A2600B92@ford.com>

Considering what goes as a 'thump to the side of the head' in this
group, I didn't consider what I wrote to be a 'flame' -- it was IMHO
pretty darn polite compared to some replies hereabouts! Sorry you 
took it like that!

Bill Jones wrote:
> 
> [Posted Only]
> 
> OK, Please allow me to clear up some things:
> 
> (My replies are interspersed below) -
> 
> > Date: Mon, 09 Aug 1999 11:25:33 -0700
> > From: David Cassell <cassell@mail.cor.epa.gov>
> > Subject: Re: send perl-users mini-faq
> > Message-Id: <37AF1D1D.E5128D03@mail.cor.epa.gov>
> >
> > Dennis M. Parrott wrote:
> >>
> >> Bill Jones wrote:
> >> >
> >> > send perl-users mini-faq
> >>
> >> ahem. Usenet IS NOT an FTP-by-email device.
> >>
> >> Read the post titled '[Perl] How to find the Perl FAQ' which
> >> can be found in the comp.lang.perl.announce newsgroup on a
> >> very regular basis. ...and then say thank you to Tom Phoenix
> >> who makes sure that it gets posted there...
> >
> > Dennis [and others who have wondered about this]:
> >
> > I checked, and this is actually the same Bill Jones who has been
> > providing reasonably correct answers here under the alias Sneex.

I never would have known this -- I didn't make the connection.

> > <<SNIP!>>

> I did ask Dennis why he burned me via mail and posted - David didn't, but I
> was remiss and missed his post which (though no fault of his own) stated I
> am -Sneex- but Sneex didn't send the requests.
> 

Had I gone off on a rip-you-to-shreds tirade, say like, "Jones you
ignorant
moronic excuse for scum-sucking pond slime..." (which is certainly not
as 
entertaining as some of the roasting that goes down in this group!) I
could
understand you being cheesed off -- frankly, my response only emphasized 
what Usenet ain't and said 'find Tom's post' which is reasonably helpful
if you were a clueless newbie (and since I didn't know you were Sneex at
that time...)...

-- 

-----------------------------------------------------------------------
Dennis M. Parrott        |            Unix:  dparrott@ford.com
PCSE Webmaster           |           PROFS:  DPARROTT
Ford Motor Company       |             VAX:  EEE1::PARROTT
Dearborn, Michigan USA   | public Internet:  dparrott@ford.com
-----------------------------------------------------------------------
Voice: 313-322-4933  Fax: 313-248-1234  Pager: 313-851-2958


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

Date: Wed, 11 Aug 1999 09:29:43 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Simple Perl Parsing?
Message-Id: <x3y4si6bg3c.fsf@tigre.matrox.com>


"Chao Fang" <cfang@nwu.edu> writes:

> $line =~ /(STARThello worldEND)/;
> print $1;

What if the the match didn't succeed? You'll print nothing, and you'll
get a warning (if you're using '-w' .. which you should be).

The proper way to do this is:

	print $1 if $line =~ /(STARThello worldEND)/;

or

	$line =~ /(STARThello worldEND)/ && print $1;

Ala



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

Date: 11 Aug 1999 15:25:59 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Slight problem with
Message-Id: <750qx@questionexchange.com>

> Hi.   I'm using Getopt::Long in a program, and have bumped into
> a small annoyance.  This is how I call it.  my %opt = (); my
> @valid_options = qw/help debug:i verbose trace images! force!
> xml! all/; GetOptions (\%opt, @valid_options);  As you can see,
> debug is the only option that can take an optional integer
> argument.  So when i call the program with  ./program.pl -help
> -debug -verbose -trace -images -force -xml -all  then help,
> verbose, trace, images, force, xml and all in %opt will be set
> to 1 and $opt{debug} will be set to 0. While it makes sense to
> me that all the boolean values are set to 1, I'd really like
> $opt{debug} to be set to 1 when it appears among the arguments,
> instead of 0 which it is now. From what I can tell from the
> docs this is a feature, it just happens to be a feature I don't
> particularly care for. Anyway - I've made this little function
> to get the behavior I prefer (yes, I know I'm modifying
> @valid_options with this, but it doesn't matter at the moment)
> for (grep s/:i$// => @valid_options)  {$opt{$_} ||= defined
> $opt{$_} ? 1 : 0}  but I'm left with the feeling that I must
> have missed a part of the manual from Getopt::Long.  Another
> problem with this is of course that it's impossible to set the
> option to 0 from the commandline, you have to _not_ use the
> option to get it set to 0  Well, I guess the question boils
> down to: Do I have to scan through the options like this or did
> I miss an option from the Getopt::Long manual?  I'm of course
> also open for suggestions to better ways of translating the
> values  -- Trond Michelsen

No, you seem to have it all correct.   However, allow me to
recommend to you Damian Conway's Getopt::Declare which makes
argument processing much more interesting as well as generating
usage info at the same time.  Getopt::Long is not such a hot
module.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2509&cus_id=USENET&qtn_id=1667


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

Date: Wed, 11 Aug 1999 07:49:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: turn $6 into $6000
Message-Id: <MPG.121b2d413991c4ca989e30@nntp.hpl.hp.com>

In article <slrn7r2bpf.cat.abigail@alexandra.delanet.com> on 11 Aug 1999 
03:07:29 -0500, Abigail <abigail@delanet.com> says...
 ...
> $x = '$6';
> $x ++ until $x =~ /^6/ && $x =~ /.(.)\1\1/;
> print $x;

Florins or guilders or euros or ...?  Read the Subject again.  :-)

  print "\$$x";

But that solution is only O(N).  Surely you can do worse.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 11 Aug 1999 09:19:32 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <x3y672mbgkb.fsf@tigre.matrox.com>


wvenable_net@iname.com (Wayne Venables) writes:

>   Perl orginally drove me absolutely insane; it took me a few weeks
> (as I'm sure it takes everyone) to really get a feel for it.

You're wrong there.
I loved Perl just after reading the first few pages in the Llama
(that's the Foreword by lwall).

What's the problem of having "different" syntax as long as it gets the
job done quickly and efficiently?

Ala



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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 461
*************************************


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