[16703] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4115 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 24 03:05:34 2000

Date: Thu, 24 Aug 2000 00:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967100715-v9-i4115@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 24 Aug 2000     Volume: 9 Number: 4115

Today's topics:
        @ARGV parameters <Jed@TheForge.Kom>
    Re: @ARGV parameters <juex@my-deja.com>
    Re: @ARGV with ( and ) symbols in it <juex@my-deja.com>
    Re: A Proposal for BaseLib module (was Re: Modifying @I (Malcolm Dew-Jones)
        Blat and Perl ?! reevehot@hotmail.com
    Re: Deleteing a file (Rafael Garcia-Suarez)
    Re: Forking in WinNT (Martien Verbruggen)
    Re: HELP ME!!! THIS IS SERIOUS:( <juex@my-deja.com>
    Re: help!! (Keith Calvert Ivey)
    Re: How to Include a Perl script in a Perl script <timewarp@shentel.net>
    Re: How to split mailheaders (Keith Calvert Ivey)
    Re: Just another silly post. <joehecht@code4sale.com>
    Re: Modifying @INC: my problem and solution (any commen (Malcolm Dew-Jones)
    Re: mysterious error, posibly regarding return or else drdementor@my-deja.com
        Numberical args from cmdline. johnvert@my-deja.com
    Re: Numberical args from cmdline. <jkline@one.net>
    Re: Numberical args from cmdline. <khaines@oshconsulting.com>
    Re: Numberical args from cmdline. <lr@hpl.hp.com>
    Re: Numberical args from cmdline. <uri@sysarch.com>
    Re: Numberical args from cmdline. <khaines@oshconsulting.com>
    Re: Numberical args from cmdline. (Steve Leibel)
    Re: Perl vs. other scripting languages (Gwyn Judd)
    Re: Perl vs. other scripting languages <katz@underlevel.net>
    Re: Perl vs. other scripting languages <katz@underlevel.net>
    Re: Perl vs. other scripting languages <uri@sysarch.com>
    Re: Perl vs. other scripting languages (Steve Leibel)
    Re: Rationale Behind 'Use of Uninitialized Value' Warni (Craig Berry)
    Re: Regular expression, $1 in a $variable. <methabol@hem.passagen.se>
    Re: self writing program <stephen@math.missouri.edu>
    Re: self writing program (Rafael Garcia-Suarez)
    Re: Self-Answering Questions (Was Re: Flipflop matching <jeff@vpservices.com>
    Re: Set @ARGV and ignore STDIN? <r28629@email.sps.mot.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 24 Aug 2000 00:26:02 -0400
From: "Jed" <Jed@TheForge.Kom>
Subject: @ARGV parameters
Message-Id: <7u1p5.639$bf.4189@news1.fdn.com>

How do I access the original search pattern passed on the command line.

EX:

/[Proggies] /dosometing.pl *.tar.gz *.tar

I am working on creating a simple program to rename files (using PERL
functions and regexps).

Its just a learning project but its been kicking my behind.  I get a list of
files but I have been unable to get the first parameter pattern *.tar.gz.
Instead I get a list of files that end in tar.gz.







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

Date: Wed, 23 Aug 2000 21:39:36 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: @ARGV parameters
Message-Id: <39a4a71a@news.microsoft.com>


"Jed" <Jed@TheForge.Kom> wrote in message
news:7u1p5.639$bf.4189@news1.fdn.com...
> How do I access the original search pattern passed on the command line.
> /[Proggies] /dosometing.pl *.tar.gz *.tar
> Its just a learning project but its been kicking my behind.  I get a list
of
> files but I have been unable to get the first parameter pattern *.tar.gz.
> Instead I get a list of files that end in tar.gz.

Well, it's the shell which does the file name globbing, your Perl program
never sees the "*" in the first place. In so far this is not a Perl question
at all.
If you want to pass a "*" to you script then you have to escape the "*" one
way or the other. How to do that depends on your favorite shell (see its man
page), but you may want to try "\*" or enclosing the argument in single
quotes.

jue




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

Date: Wed, 23 Aug 2000 21:42:09 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: @ARGV with ( and ) symbols in it
Message-Id: <39a4a7b2@news.microsoft.com>

"Graham Wood" <graham.wood@iona.com> wrote in message
news:8o0tt8$cjt$1@bvweb.iona.com...
> I'm attempting to write a script that will accept OS/390 dataset names and
> members thereof as input.  The command line will look like:
>
> process.pl GWOOD.UTIL.JCL(STARTUP)
>
> Sadly perl is complaining that it is getting a "(" where it was expecting
a
> newline.

I bet this has nothing to do with Perl but it's your shell that is acting
up.
Try enclosing the argument in quotes, maybe that will help.

jue




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

Date: 23 Aug 2000 22:34:13 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: A Proposal for BaseLib module (was Re: Modifying @INC...)
Message-Id: <39a4b3d5@news.victoria.tc.ca>

Hasanuddin Tamir (hasant@trabas.com) wrote:
: In article <sq8n506bt91153@corp.supernews.com>,
:   "Chris Stith" <mischief@motion.thispartfake.net> wrote:
: >
: > "Malcolm Dew-Jones" <yf110@vtn1.victoria.tc.ca> wrote in message
: > news:39a41d62@news.victoria.tc.ca...
: > > hasant@trabas.com wrote:
: > > : The Problem
: > >
: > > : Determine a non-standard module path dynamically
: > > : in the scripts.
: > >
: > > Can you not define the PERL5LIB environment variable before hand?
: >
: > I might even suggest putting a small config file in the
: > application's base directory, which lists where the
: > modules to be included reside. Read it in once, reuse it
: > thoughout any part of the code that needs it. This could
: > be done for the base directory, too, for that matter, in case you need
: to
: > find data files or whatever based on that.

: Then how do you define the full path to that config file? As I
: suppose it must be read by every script.

That depends on what your situation is.

If your scripts are being run by a web server then confirm what
conventions it uses regarding the current directory when a script starts
and place the config file relative to that.

I have heard that different servers have different conventions - though
the only convention I have ever come across is that a script starts in
it's own base directory.  E.g. /web_stuff/mycgi.pl will be running in the
/web_stuff directory. 

A typical technique is to have several links of a script in different
directories.  Each directory has its own copy of a file, perhaps called
"config.pm", that has customized settings for the scripts that start in
that directory. 

The config settings control what the script does.

The web server controls who has access to which directory, and hence
indirectly controls what a user can do when running the script.


Another scenario is that a regular user is using your script from the
shell prompt.  It might then be the user's responsibility to run a config
script before they run you application.  (A well known example of this
strategy is Oracle). 

Or use a variable such as the username to find the directory (like .shrc
and etc.)

You could also have a single hard coded name, and have that script
determine what configuration should be used by examining such items as the
username, the current directory, the calling scripts name, etc.

I assume that some will take issue with any one of these, though I have
come across all of them in use.




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

Date: Thu, 24 Aug 2000 05:01:19 GMT
From: reevehot@hotmail.com
Subject: Blat and Perl ?!
Message-Id: <8o2a6m$fa7$1@nnrp1.deja.com>

I have a Formmail perl script which purports to run with Blat. Sure the
script runs on my host's NT machine, but it fails to send the mail.

Here's the advice my not-so-helpful host suggested:

This problem is a coding error in the perl script the following line is
incorrect
open(MAIL,"|$mailprog -t");
You have not stated a "send to" address. I would recommend the use
of "smtp.server-mail.com"

The first problem is that the line referred to appears to be ignored in
the script. (by the way, $SERVER_OS="WIN") eg.

   if ($SERVER_OS eq "WIN") {
     open(MAIL,">$WIN_TEMPFILE");
     local($BLAT_ARGS);
   } else {
     open(MAIL,"|$mailprog -t");
   }


So am I right to assume that advice was faulty?

Secondly, if the following excerpt is true to name, is there something
I have to do to make it point to Blat?

  # If we're running under Windows, we actually send mail here...
   if ($SERVER_OS eq "WIN") {
     $WIN_TEMPFILE =~ s/\//\\/g;
     $mailprog =~ s/\//\\/g;
     $BLAT_ARGS = "$WIN_TEMPFILE -t $CONFIG{'recipient'} -penguin ";
     $BLAT_ARGS .= "-f $CONFIG{'email'} " if defined($CONFIG{'email'});
     $BLAT_ARGS .= "-q";
     system "$mailprog $BLAT_ARGS";
     unlink $WIN_TEMPFILE;

Thanks anyone!

James


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 24 Aug 2000 07:03:28 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Deleteing a file
Message-Id: <slrn8q9igr.g8l.rgarciasuarez@rafael.kazibao.net>

blindemann@my-deja.com wrote in comp.lang.perl.misc:
>I am a PERL rookie, so this may be basic for some of you, so I
>apologize in advance if it is!
>I have a scprit I wrote that returns some info to the browser.  After
>this is complete, I want to delete a file that contains data that was
>used in running the script and returned to the browser.  At the very
>end of my scprit after the html is returned to the browser, I added
>unlink myfile.dat;
>
>Evidently it deletes the file quicker then the HTML fills the page
>because with the unlink at the end of my script, my data doesnt come up
>in the browser.

No. If I understand correctly: 'unlink' being at the end of the script,
i.e. after all print statements, all HTML is already generated when the
file is unlinked. But the browser may be still receiving the CGI output
through the network connection.

At the end of your script, put:
  unlink 'myfile.dat' or print STDERR "Can't unlink myfile.dat: $!\n";
This will print in the error logs what's wrong with the unlink.

In fact I guess that you didn't check the return value of open() when
you opened myfile.dat. Check that too.

-- 
Rafael Garcia-Suarez


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

Date: Thu, 24 Aug 2000 06:58:14 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Forking in WinNT
Message-Id: <slrn8q9hrf.ma.mgjv@verbruggen.comdyn.com.au>

On 24 Aug 2000 02:29:15 GMT,
	Abigail <abigail@foad.org> wrote:
> Jeff Susanj (jeffrey.l.susanj@boeing.com) wrote on MMDXLVIII September
> MCMXCIII in <URL:news:FzpBu6.93t@news.boeing.com>:
> )) 
> )) Windows NT does not support fork.
> 
> But Perl 5.6.0 on Windows NT supports fork().

While that is true, the unsuspecting user should be warned that it is
an emulation based on process threads, and therefore thread share the
same process space, which means that compiled in C code should be
thread-safe.

There are other limitations/differences. Read the perlfork
documentation for more info

# perldoc perlfork

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Wed, 23 Aug 2000 21:48:10 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: HELP ME!!! THIS IS SERIOUS:(
Message-Id: <39a4a918$1@news.microsoft.com>

<lngkrp@nurb.com> wrote in message
news:a_Jo5.11416$4f5.5555@telenews.teleline.es...
[scam scheme deleted]

Indeed, it requires a serious answer

    ***PLONK***

jue




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

Date: Thu, 24 Aug 2000 04:20:18 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: help!!
Message-Id: <39a5a05f.15118526@news.newsguy.com>

"Lucas Tsoi" <lucas@cplhk.com> wrote:

>I got a question about interpolation, I found the programm
>always go error because the non-Englsih codes have invliad
>characters.
>------------------------------------------------------------
>print qq~
>    $a 's Chinese is ( chinese codes here )
>    $b 's Japannese is ( japanese codes here )
>    $c 's  Korean is ( korea codes here )
>~;

Presumably the CJK codes contain ~ or $ or @.  The problem of ~
can be avoided by using a here-doc:

    print <<EOT;
    $a's Chinese is ( chinese codes here )
    $b's Japanese is ( japanese codes here )
    $c's Korean is ( korea codes here )
    EOT

See perldata, under "Scalar value constructors".  Unfortunately,
you'll still have the problem of $ and @.  Could you put your
CJK text into variables first?

    print <<EOT;
    $a's Chinese is $c_text
    $b's Japanese is $j_text
    $c's Korean is $k_text
    EOT

If not, you may just have to put backslashes before all
occurrences of $ and @ in the CJK text.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Thu, 24 Aug 2000 02:35:23 -0400
From: Albert Dewey <timewarp@shentel.net>
Subject: Re: How to Include a Perl script in a Perl script
Message-Id: <39A4C22B.CFC192EC@shentel.net>

Okay - a lot of people told you to use 'require' to import another perl
script into an active one. This much is correct but you will have to do
another very important thing or this will not work. At the very end of the
script that you wish to require add this line of code -

return 1;

Trust me - you will need this . . . .

Albert Dewey


> Keith Smith (ksmith@firesnacks.com) wrote on MMDL September MCMXCIII in
> <URL:news:Dy_o5.25048$eR5.757311@news1.rdc1.on.wave.home.com>:
> :: HI:
> ::
> :: I am looking for something akin to C's #include "header.h".
> ::
> :: What would be the PERL equivalent?



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

Date: Thu, 24 Aug 2000 04:07:18 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: How to split mailheaders
Message-Id: <39a49f27.14806543@news.newsguy.com>

I wrote:

>    my @header = split /\n(?=\S|$)/, $header;

This is nicer:

     my @header = split /\n(?!\s)/, $header;

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Thu, 24 Aug 2000 05:57:38 GMT
From: "Joe C. Hecht" <joehecht@code4sale.com>
Subject: Re: Just another silly post.
Message-Id: <mP2p5.1343$CA4.475908@paloalto-snr1.gtei.net>

> I have a challenge for you.

Is this a homework assignment you need help with?




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

Date: 23 Aug 2000 22:09:35 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Modifying @INC: my problem and solution (any comment?)
Message-Id: <39a4ae0f@news.victoria.tc.ca>

Hasanuddin Tamir (hasant@trabas.com) wrote:
: In article <39a41d62@news.victoria.tc.ca>,
:   yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote:
: > hasant@trabas.com wrote:
: > : The Problem
: >
: > : Determine a non-standard module path dynamically
: > : in the scripts.
: >

: > Also useful, a module can be in more than one location - you can place
: any
: > number of test versions in directories earlier in the path to
: temporarily
: > replace a module.

: What you mean by "temporarily replace a module"?


if my @INC had

 ./perl_test /usr/lib/perl

and I have a production module called xxx.pm in /usr/lib/perl then expect
to get the production version if my perl script says

	use xxx;


However, I can test a new version of xxx.pm by copying the new version
into ./perl_test and rerunning the script.  I can "uninstall" the new
version by removing or renaming it, or even just by chdir'ing to another
directory before running the script that tests xxx.pm. 

Note that I'm still running the production system in all other respects,
and the change doesn't affect anybody else, and that the production module
is not altered in any way.

The effect is to allow me to "temporarily"  replace the xxx.pm module.



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

Date: Thu, 24 Aug 2000 04:00:47 GMT
From: drdementor@my-deja.com
Subject: Re: mysterious error, posibly regarding return or else
Message-Id: <8o26l6$bfn$1@nnrp1.deja.com>

In article <tL0p5.34$r73.2554@vic.nntp.telstra.net>,
  "Wyzelli" <wyzelli@yahoo.com> wrote:
> >
> >      # @@@@@@ when I remove this code it works
> >      # I originally had a more meaningful if statement, >>>>>>>
> >      # i simplified it to try to diagnose the problem
> >      # code is so simple now i dont know why it wont work.
> >      If($error_type == 0)
> >      {
> >       print "test123"; # line 29
> >       return 0;
> >      }
>
> Start with a lower case for the i in If?
>
> Wyzelli
>
>

ya thanks that was it, wow i knew it was somethign stupid, i just
couldnt see it, oh well thanks a lot, i feel a lot better not, and less
frustrated..

Jim


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 24 Aug 2000 04:38:55 GMT
From: johnvert@my-deja.com
Subject: Numberical args from cmdline.
Message-Id: <8o28st$dvd$1@nnrp1.deja.com>

Hi, I have the following snippet:

my $n=shift or die "need number.\n";

which works fine when I pass numberical arguments to my script, but if I
pass the number 0, which is legitimate input to my program, shift thinks
no argument was passed and the die statement is executed.  How can I
overcome this?

I was thinking this must be a FAQ, but perldoc -q shift, perldoc -q ARGV
and variations of those did not turn up anything.

Thanks,
 -- john


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 24 Aug 2000 01:34:44 -0400
From: Joe Kline <jkline@one.net>
To: johnvert@my-deja.com
Subject: Re: Numberical args from cmdline.
Message-Id: <39A4B3F3.99B583A4@one.net>

[posted and mailed]

johnvert@my-deja.com wrote:
> <SNIP>
> my $n=shift or die "need number.\n";
> 
> which works fine when I pass numberical arguments to my script, but if I
> pass the number 0, which is legitimate input to my program, shift thinks

shift of course takes the first element out of whatever list it is
told to, in this case I'm assuming @ARGV. To the best of my knowledge
what is happening is not whether or not the shift succeeding but the
value of the element shifted is used in the boolean.

In the case of 0 we have:

0 or die

0 is of course false so it evaluates the die.

Can't think of a one-liner for this to be true in the case where the
element is 0. Sorry

-- 
Joe Kline

It takes a lot of brains to enjoy satire, humor, and wit;
but none to be offended by them.  ---The Midnight Skulker


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

Date: Wed, 23 Aug 2000 22:47:35 -0600
From: Kirk Haines <khaines@oshconsulting.com>
Subject: Re: Numberical args from cmdline.
Message-Id: <39A4A8E7.A49D2DCA@oshconsulting.com>

johnvert@my-deja.com wrote:
> 
> Hi, I have the following snippet:
> 
> my $n=shift or die "need number.\n";
> 
> which works fine when I pass numberical arguments to my script, but if I
> pass the number 0, which is legitimate input to my program, shift thinks
> no argument was passed and the die statement is executed.  How can I
> overcome this?

Use 2 lines:


my $n = shift;
die "need number.\n" if $n eq undef;


Or, if you really want to do it in one line:


my $n = shift ne undef or die "need number.\n";


Kirk Haines


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

Date: Wed, 23 Aug 2000 22:52:37 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Numberical args from cmdline.
Message-Id: <MPG.140e58042ac9c49e98acd3@nntp.hpl.hp.com>

In article <8o28st$dvd$1@nnrp1.deja.com>, johnvert@my-deja.com says...
> Hi, I have the following snippet:
> 
> my $n=shift or die "need number.\n";
> 
> which works fine when I pass numberical arguments to my script, but if I
> pass the number 0, which is legitimate input to my program, shift thinks
> no argument was passed and the die statement is executed.  How can I
> overcome this?
> 
> I was thinking this must be a FAQ, but perldoc -q shift, perldoc -q ARGV
> and variations of those did not turn up anything.

  defined(my $n = shift) or die "need number.\n";

There is no check shown for a number, despite your error message.

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


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

Date: Thu, 24 Aug 2000 05:58:39 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Numberical args from cmdline.
Message-Id: <x7og2jryi7.fsf@home.sysarch.com>

>>>>> "KH" == Kirk Haines <khaines@oshconsulting.com> writes:

  KH> my $n = shift;
  KH> die "need number.\n" if $n eq undef;

jeez, when will people learn that the only way to test for undef is with
defined.

and how does that test for an argument that is 'foo'?

  KH> my $n = shift ne undef or die "need number.\n";

and that is parsed as:

my $n = (shift ne undef) or die "need number.\n";

not what you meant, i bet.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 23 Aug 2000 23:20:05 -0600
From: Kirk Haines <khaines@oshconsulting.com>
Subject: Re: Numberical args from cmdline.
Message-Id: <39A4B085.C321F80E@oshconsulting.com>

Uri Guttman wrote:
> 
> >>>>> "KH" == Kirk Haines <khaines@oshconsulting.com> writes:
> 
>   KH> my $n = shift;
>   KH> die "need number.\n" if $n eq undef;
> 
> jeez, when will people learn that the only way to test for undef is with
> defined.

Jeez, when will people learn not to be rude randomly?

die "need number.\n" unless defined $n;

is certainly more efficient than the first thought that I had, but it
certainly isn't "the only way".

> and how does that test for an argument that is 'foo'?
> 
>   KH> my $n = shift ne undef or die "need number.\n";
> 
> and that is parsed as:
> 
> my $n = (shift ne undef) or die "need number.\n";
> 
> not what you meant, i bet.

Ugh.  No, not what I meant.

(my $n = shift) ne undef or die "need number.\n";

is what I meant.

And the better solution probably is:

defined(my $n = shift) or die "need number.\n";

Functionally, the two perform identically, however.


Kirk Haines


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

Date: Wed, 23 Aug 2000 23:26:06 -0700
From: stevel@bluetuna.com (Steve Leibel)
Subject: Re: Numberical args from cmdline.
Message-Id: <stevel-2308002326060001@192.168.100.2>

In article <8o28st$dvd$1@nnrp1.deja.com>, johnvert@my-deja.com wrote:

> Hi, I have the following snippet:
> 
> my $n=shift or die "need number.\n";
> 
> which works fine when I pass numberical arguments to my script, but if I
> pass the number 0, which is legitimate input to my program, shift thinks
> no argument was passed and the die statement is executed.  How can I
> overcome this?
> 
> I was thinking this must be a FAQ, but perldoc -q shift, perldoc -q ARGV
> and variations of those did not turn up anything.


I wrote this little program and called it "zero".

#!/usr/local/bin/perl -w
use strict;
my $x = $ARGV[0];

if (defined($x)) {
    print "it's defined\n";
}
else {
    print "it's not defined\n";
}

Then I ran it with no args and with an arg of 0, and got this output:

% zero
it's not defined
% zero 0
it's defined

So I think this will solve your problem.

Steve L


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

Date: Thu, 24 Aug 2000 04:07:49 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl vs. other scripting languages
Message-Id: <slrn8q97sd.b19.tjla@thislove.dyndns.org>

I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:
>KN (khayyam.noon@unisys.com) wrote on MMDXLIX September MCMXCIII in
><URL:news:8o1dql$8d7$1@trsvr.tr.unisys.com>:
>][ What are the pros and cons of using Perl versus other scripting languages?
>
>Pros:  Having dinner with Perl Mongers.
>       Camels can go weeks without water.
>           (But Pythons can go weeks without food)

Camels too I believe, if I recall the project I did at school many years
ago

>       Luke warm balls.

<blink>

>       It looks like line noise - even your cat can program!

Not my cat. He always forgets what the $_ variable does.

>       Damian Conway.

Who's Damian Conway?

>       Perl Golf.
>       Cute babes.

Where? Where?

>       JAPHs.

Speaking of which, here is my pathetic effort:

$,=" "; @x{qw(Just Another PERL Hacker)}='';
print map(ucfirst lc, reverse %x)

>       Cheap puns.
>Cons:  Having dinner with Perl Mongers.
>       There are no fun anagrams of "Larry Wall".

Awl Rally'r?
Not enough nouns I think.

>       Godzilla.
>       People claim you can program OO in Perl.

Hah! I claim you can program OO in C++. Beat that!

>       Slashdot.
>       Each new version of Perl will break half of your programs.

*cough* not everyone programs quite like you though :)

>       Perl is hard for most people to write. They write PERL or Pearl.

Fortunately although "Perl" is hard for people to write, Perl is not
difficult for people to err...write in

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"People get annoyed when you try to debug them."

  -- Awl Rally'r (Open Sources, 1999 O'Reilly and Associates)


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

Date: 24 Aug 2000 00:59:39 -0400
From: Jordan Katz <katz@underlevel.net>
Subject: Re: Perl vs. other scripting languages
Message-Id: <m3snrvfe4k.fsf@underlevel.underlevel.net>

brian@smithrenaud.com (brian d foy) writes:

> In article <m37l97ir6n.fsf@underlevel.underlevel.net>, Jordan Katz
> <katz@underlevel.net> posted:
> 
> >   1. Scripting: Higher Level Programming for the 21st Century
> >      <http://www.scriptics.com/people/john.ousterhout/scripting.html>
> > 
> >   2. Comparing Python to Other Languages
> >      <http://www.python.org/doc/essays/comparisons.html>
> > 
> > Although the second is Python-centric it contains some useful information.
> 
> but you didn't mention the Tcl bias of the first ;)

All articles are biased -- if not to Tcl, then to some other language
the author of the article happens to like.  It's just that the second
one focuses on Python more than the other languages mentioned.
-- 
Jordan Katz <katz@underlevel.net>


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

Date: 24 Aug 2000 01:01:56 -0400
From: Jordan Katz <katz@underlevel.net>
Subject: Re: Perl vs. other scripting languages
Message-Id: <m3og2jfe0r.fsf@underlevel.underlevel.net>

tjla@guvfybir.qlaqaf.bet (Gwyn Judd) writes:

> >       Damian Conway.
> 
> Who's Damian Conway?

I believe he's the author of Glade and a few Perl modules (look him up
on CPAN.)  Why is he mentioned?  No idea. 
-- 
Jordan Katz <katz@underlevel.net>


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

Date: Thu, 24 Aug 2000 05:15:34 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl vs. other scripting languages
Message-Id: <x7r97fs0i0.fsf@home.sysarch.com>

>>>>> "JK" == Jordan Katz <katz@underlevel.net> writes:

  JK> tjla@guvfybir.qlaqaf.bet (Gwyn Judd) writes:
  >> >       Damian Conway.
  >> 
  >> Who's Damian Conway?

  JK> I believe he's the author of Glade and a few Perl modules (look him up
  JK> on CPAN.)  Why is he mentioned?  No idea. 

huh? glade is a gui development tool and damian hasn't done much
graphics work that i know about. but he posts here sometime when
subjects that interest him crop up. 

FYI he is a professor of CS in australia and the author of one of the
best perl books 'object oriented perl'. he has authored modules which
support what abigail claims can't be done in OO perl. he is also very
funny, witty and a very nice guy.

he was mentioned because abigail knows he is one of the best things perl
has going for it and i agree.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 23 Aug 2000 23:18:27 -0700
From: stevel@bluetuna.com (Steve Leibel)
Subject: Re: Perl vs. other scripting languages
Message-Id: <stevel-2308002318540001@192.168.100.2>

In article <slrn8q9548.tj3.abigail@alexandra.foad.org>, abigail@foad.org wrote:

>        Each new version of Perl will break half of your programs.


Abigail,

I am so glad to see one of the really knowledgeable people around here
admit to that.  I know your remark is tongue-in-cheek but there's a lot of
truth to it.

As a working programmer who always needs to get things done fast to keep
up with my dotcom clients, I'd gladly trade new features for stability. 
Most programmers tend to get comfortable with a core set of any
language.   And in production environments, you need stability so you can
tell management that it's safe to upgrade to the latest Perl release. 
Right now I can't do that.  

I'm hoping the designers of Perl 6 will give consideration to the needs of
programmers who enjoy Perl but don't have time to keep up with an
ever-changing language; and who need release stability to protect
production environments.

I'm interested in hearing how others feel about these issues.

Thanks for listening,

Steve L


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

Date: Thu, 24 Aug 2000 04:35:28 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Rationale Behind 'Use of Uninitialized Value' Warning
Message-Id: <sq99ggmat91122@corp.supernews.com>

Gabe (grichard@uci.edu) wrote:
: Hmmm. OK, how do you catch more bugs? Here's the situation. I want to assign
: the variable in a loop, but I want it's scope to be out of the loop so I can
: do something with it so my code is like:
: 
: my $foo;
: 
: while (condition) {
:     if (condition) {$foo = 'foo'};
: }
: 
: #do something with $foo...
: 
: Now why would it be better to say
: 
: my $foo = '';
: 
: instead?

Because it documents, for you and any other future maintainers of your
code, that the while loop exiting without that condition ever being true
is not an error; that you *intended* a blank string as the default
outcome, rather than having missed a possible outcome.  See the
difference?

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Every force evolves a form."
   |              - Shriekback


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

Date: Thu, 24 Aug 2000 06:18:42 +0200
From: Dan Zetterstrom <methabol@hem.passagen.se>
Subject: Re: Regular expression, $1 in a $variable.
Message-Id: <sg29qso4a9u9fubmgrsp093n8bqj2o3cnu@4ax.com>

On 23 Aug 2000 07:49:09 GMT, Steve Mading
<madings@baladi.bmrb.wisc.edu> wrotc:

>
>Okay, I've got a weird problem here:
>If I do this:
>
>    $searchfor = '([0-9]+)\.txt';
>    $replacewith = '$1-num-text';
>    $str =~ s/$searchfor/$replacewith/eg;
>
>I want it to work the same as this:
>
>    $str =~ s/([0-9]+)\.txt/$1-num-text/eg;
>
You could try this:

$searchfor = '(?<=[0-9])\.txt';
$replacewith = '-num-text';
$str =~ s/$searchfor/$replacewith/g;

-DZ
-- 
Tell me your dreams and I will crush them.


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

Date: Thu, 24 Aug 2000 06:23:47 GMT
From: Stephen Montgomery-Smith <stephen@math.missouri.edu>
Subject: Re: self writing program
Message-Id: <39A4BF72.32E0C66E@math.missouri.edu>

Rafael Garcia-Suarez wrote:
> 
> Some time ago, the following was posted here:
>   open 0;print<0>
> 
> The main advantage of this program is that it lets you learn something
> about open. (see perlfunc...)

This looks really nice, but I couldn't figure out why it worked
from reading perlfunc.  Anyone wish to offer me clues?


-- 
Stephen Montgomery-Smith
stephen@math.missouri.edu
http://www.math.missouri.edu/~stephen


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

Date: Thu, 24 Aug 2000 06:40:06 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: self writing program
Message-Id: <slrn8q9h51.g8l.rgarciasuarez@rafael.kazibao.net>

Stephen Montgomery-Smith wrote in comp.lang.perl.misc:
>Rafael Garcia-Suarez wrote:
>> 
>> Some time ago, the following was posted here:
>>   open 0;print<0>
>> 
>> The main advantage of this program is that it lets you learn something
>> about open. (see perlfunc...)
>
>This looks really nice, but I couldn't figure out why it worked
>from reading perlfunc.  Anyone wish to offer me clues?

Lookup also $0 in perlvar.

-- 
Rafael Garcia-Suarez


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

Date: Wed, 23 Aug 2000 21:12:37 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Self-Answering Questions (Was Re: Flipflop matching)
Message-Id: <39A4A0B5.BD09DE49@vpservices.com>

Keith Calvert Ivey wrote:
> 
> Jeff Zucker <jeff@vpservices.com> wrote:
> 
> >how do I split a string into parts?
> 
> It seems to me that most of the people who ask that question in
> this newsgroup are trying to use split() when they should be
> using substr(), unpack(), or a regex with capturing parentheses.

True, but I was having a devil of a time trying to make an English
sentence with the phrase 'substr' in it.  Hey, lookit, I just succeeded!
:-)

-- 
Jeff


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

Date: Thu, 24 Aug 2000 12:19:26 +0800
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Set @ARGV and ignore STDIN?
Message-Id: <39A4A24E.65A9543F@email.sps.mot.com>

philip.hibbs@tnt.co.uk wrote:
> 
> Here's my code:
> 
> #!/usr/bin/perl
> 
> use Text::Wrap;
> 
> # @files = sort {-M $a <=> -M $b} <*.txt>; # sort files by age
> # $file = shift @files;                   # get the first (newest)
> # undef @files;                          # free up memory
> # @ARGV = ($file);                      # set list of files to process
> # print @ARGV;
> 
> $match = shift;
           ^^^^^<----- hmmm....
> 
> while (<>) {
>     chomp;
>     print "\r".$_ if m/[0-9]{4}/i;
>     print wrap("\n "," ",$_)."\n" if m/$match/i;
> }

HTH.

-TK


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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