[10503] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4095 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 28 17:06:46 1998

Date: Wed, 28 Oct 98 14:00:24 -0800
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, 28 Oct 1998     Volume: 8 Number: 4095

Today's topics:
        A Decent tutorial on SQL Web Databases (John Hardy)
    Re: add a hash to another? <avitala@macs.biu.ac.il>
        after gathering information through a form and printing (John Hardy)
        CGI.pm and 5.003 for win32? <bbarnes@dev.tivoli.com>
    Re: Checking for only numbers (brian d foy)
    Re: Checking Input for Exactly 2 numbers (brian d foy)
    Re: Checking Input for Exactly 2 numbers (Greg Bacon)
    Re: Checking Input for Exactly 2 numbers <r28629@email.sps.mot.com>
    Re: Comparative modularization (was: Not to start a lan (Larry Wall)
    Re: Confused by the shebang thang <uri@fastengines.com>
        Does Text::ParseWords / &quotewords() suck (or is it me (Brian G.)
        eliminating duplicate lines ()
    Re: getopts question <kprice@cardinal.co.nz>
    Re: getopts question <kprice@cardinal.co.nz>
    Re: getopts question (Larry Rosler)
    Re: grabbing timezone withing cgi environ using perl (M.)
        Increasing hash value size beyond 1024 bytes in DBMs (Tom O'Neil)
    Re: Increasing hash value size beyond 1024 bytes in DBM <mcolbert@netgenics.knowspaaaamm.com>
    Re: Initializing a hash of arrays (Brand Hilton)
        Is undef the best way to initialize a hash? <sirron@mail.mcoe.k12.ca.us>
    Re: Monitoring a child process. (Andrew M. Langmead)
        More Serial Port Problems scott@jtsmith.com
    Re: new to perl (maybe) (M.)
        POD syntax? (Doug O'Leary)
    Re: POD syntax? (brian d foy)
    Re: POD syntax? (Greg Bacon)
    Re: problem with file test -e <avitala@macs.biu.ac.il>
    Re: problem with file test -e (Matthew Bafford)
    Re: Problem with Text::ParseWords (Brian G.)
    Re: Reg. expr. question (Tad McClellan)
        Simple regular expression (HELP)..... amatot@my-dejanews.com
    Re: Simple regular expression (HELP)..... (Brand Hilton)
    Re: Syntactic flexibility (was: Re: psychology of langu <jdporter@min.net>
    Re: system() function on PERL for Win32 hippie@net-alert.com
    Re: Where are Tom Christiansen's Perl Style Slide Files (Matthew Bafford)
    Re: Where are Tom Christiansen's Perl Style Slide Files <tchrist@mox.perl.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 28 Oct 1998 20:13:38 GMT
From: jhardy@cins.com (John Hardy)
Subject: A Decent tutorial on SQL Web Databases
Message-Id: <SVKZ1.115$%Z6.110833@198.235.216.4>


If any of you are just starting out with web databases and SQL there is 
a pretty good tutorial at 

http://wdvl.com/Authoring/DB/Intro/toc.html


done by Selena Sol.




 Didn't help me out with ADO but I was finally able to 
figure it out on my own . 


John 



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

Date: Wed, 28 Oct 1998 22:01:41 +0200
From: "Avshi Avital" <avitala@macs.biu.ac.il>
Subject: Re: add a hash to another?
Message-Id: <717tap$kv6$1@cnn.cc.biu.ac.il>

>how do you join two hashes together? Supposed I have %a and %b,
>and I would like to make %a contain all the keys/values from %b.
>The "push %a, %b" does not work for me...


%a=(a,1,b,2);
%b=(c,3,d,4);
%c=(%a,%b);
foreach $t (a, b,c,d) {
    print "$c{$t} ";
}

the output:

1 2 3 4

Avshalom Avital
Information Retrieval Laboratory
Bar-Ilan University, Israel
avitala@macs.biu.ac.il





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

Date: Wed, 28 Oct 1998 19:53:25 GMT
From: jhardy@cins.com (John Hardy)
Subject: after gathering information through a form and printing out response want to continue printing on the same page using a PERL script
Message-Id: <VCKZ1.101$%Z6.110833@198.235.216.4>

Is it possible to have PERL recieve incoming data from a form
Print out the data for the user to see, ask the user if it is correct, then
allow the user to press a continue button and continue printing out
the remaining information on the same page ??

So far I have it reading in the form information and printing it out for the
user to view. The script then continues to do some SQL SELECT and INSERT
routines.

But before it does those routines I would like the user to verify the first
bit of information that was printed and then press a continue button and have
the script perform the SQL statements and continue printing out the returned
value from the SQL statements on the same page with out having to create
another HTML page.

I hope I have explained this properly.

Anybody have any coding examples or ideas to do this?



Thanks for any help

John



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

Date: Wed, 28 Oct 1998 14:55:33 -0600
From: "Brian P. Barnes" <bbarnes@dev.tivoli.com>
Subject: CGI.pm and 5.003 for win32?
Message-Id: <363784C5.92FF9096@dev.tivoli.com>

Hi,

I just got Lincoln Stein's new book, "Official Guild to Programming with
CGI.pm" and am trying his first test of web server configuration:

C:/bin>perl
use CGI qw/:standard/;
Perl 5.004 required--this is only version 5.00307, stopped at
C:\Perl\lib/CGI.pm line 2.
BEGIN failed--compilation aborted at - line 1.

The active state port is only at 5.003 (I just downloaded it yesterday).
Where can I get 5.004 binaries for windoz?

Thank you,

    Brian




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

Date: Wed, 28 Oct 1998 16:49:19 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Checking for only numbers
Message-Id: <comdog-ya02408000R2810981649190001@news.panix.com>

In article <36376795.5AD4BCB@worldnetcorp.com>, Chintan Adhyapak <ChintanA@worldnetcorp.com> posted:

> if ($foo !~ /^[0-9]+$/)

another nifty way to do this is

   $foo =~ /\D/;

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 28 Oct 1998 16:46:40 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Checking Input for Exactly 2 numbers
Message-Id: <comdog-ya02408000R2810981646400001@news.panix.com>

In article <36376C1B.26C3B2CD@counter.w-dt.com>, Mike <support@counter.w-dt.com> posted:

> How would you check the input then to make sure it has exactly two
> numbers inputed. Not more not less.

two numbers or one number with two digits?  if the latter, which base?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 28 Oct 1998 20:36:12 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Checking Input for Exactly 2 numbers
Message-Id: <717v7s$rkr$1@info.uah.edu>

In article <fl_aggie-2810981437120001@aggie.coaps.fsu.edu>,
	fl_aggie@thepentagon.com (I R A Aggie) writes:
: In article <36376C1B.26C3B2CD@counter.w-dt.com>, Mike
: <support@counter.w-dt.com> wrote:
: + How would you check the input then to make sure it has exactly two
: + numbers inputed. Not more not less.
: 
: /^\d\d$/
: 
: The ^ and $ anchoring may be overkill, tho...

Compare

    for (1, 12, 123, "abc123") {
        print "$_ matches\n" if /\d\d/;
    }

with

    for (1, 12, 123, "abc123") {
        print "$_ matches\n" if /^\d\d$/;
    }

Greg
-- 
Why do people give each other flowers? To celebrate various important
occasions, they're killing living creatures? Why restrict it to plants?
"Sweetheart, let's make up.  Have this deceased squirrel."
    -- Jerry Seinfeld


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

Date: Wed, 28 Oct 1998 14:34:20 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Checking Input for Exactly 2 numbers
Message-Id: <36377FCC.CE6E1D83@email.sps.mot.com>

I R A Aggie wrote:
> 
> In article <36376C1B.26C3B2CD@counter.w-dt.com>, Mike
> <support@counter.w-dt.com> wrote:
> 
> + How would you check the input then to make sure it has exactly two
> + numbers inputed. Not more not less.
> 
> /^\d\d$/
> 
> The ^ and $ anchoring may be overkill, tho...

Overkill? not quite. See that? he wanted to match "exactly two numbers".
Without the ^ and &, these will match:

'a12b', '12xyz', 'a123435xyz', ....

-tk


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

Date: 28 Oct 1998 11:45:54 -0800
From: larry@kiev.wall.org (Larry Wall)
Subject: Re: Comparative modularization (was: Not to start a language war but..)
Message-Id: <717s9i$cje@kiev.wall.org>

In article <wr3pvbcbl09.fsf@yeenoghu.cs.uchicago.edu>,
Lyn A Headley  <laheadle@boguscs.uchicago.edu> wrote:
>claird@Starbase.NeoSoft.COM (Cameron Laird) writes:
>
>
>> More pertinent is that Scheme *lacked* a module system
>> during the interval when the developers referenced earl-
>
>I think it is most pertinent to say that *Scheme* lacks a module
>system.  :)

Odd how you can say something pertinent and impertinent simultaneously.  :-)

Larry


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

Date: 28 Oct 1998 15:54:33 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Confused by the shebang thang
Message-Id: <saryaq076gm.fsf@camel.fastserv.com>

>>>>> "DB" == Dave Barnett <barnett@houston.Geco-Prakla.slb.com> writes:


  >> 2) I haven't been able to find any more specific info on the
  >> shebang's but aren't they supposed to be understood like directions
  >> to the perl compiler? When can you leave them out?
  DB> The shebang line is a directive to whatever 'shell' is
  DB> interpreting the file.  #!/usr/local/bin/perl at the beginning,
  DB> when invoked from a shell tells your shell (sh, csh, ksh, tcsh,
  DB> bash, whatever) to run /usr/local/bin/perl and pass in this
  DB> script.

incorrect, little buddy!

the shell never looks at the #! line. the shell just makes sures the
file has the execute bits set and calls exec on the file (after a fork
of course). exec in the kernel checks for #! (if it is a not binary) and
then runs the program (called an interpreter) following it and passing
the script path as an argument to the interpreter. read the exec man
page for more details.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 28 Oct 1998 16:21:41 -0500
From: briang@access5.digex.net (Brian G.)
Subject: Does Text::ParseWords / &quotewords() suck (or is it me)?
Message-Id: <7181t5$ggk@access5.digex.net>

Is there any way to keep &quotewords from taking down your whole script if
it finds something it doesn't like?

If it finds a mismatched quote or a random backslash it crashes with 

	Unmatched quote at ./program.pl line #

Is there some way to trap this error?  Is there a more robust routine or
regular expression that I can use that is a bit more tolerant of bad user
input?

Everything I've read on dejanews for reading CSV files says to use 
&quotewords, so I am guessing I must not know something everyone else does.

Anybody want to fill me in?  :-)

	Thanks Muchly,

	- Brian G.



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

Date: 28 Oct 1998 21:01:30 GMT
From: westi@leland.stanford.edu ()
Subject: eliminating duplicate lines
Message-Id: <westi-281098130124@fpm-sys-2140-jwestigard.stanford.edu>

I am trying to open a webserverlog file and read in all the data to a new
file The problem I'm having is eliminating all of the lines which are
duplicates. If anyone could give me a few tips, I would really appreciate
it.


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

Date: Thu, 29 Oct 1998 09:25:00 +1300
From: Kelvin Price <kprice@cardinal.co.nz>
Subject: Re: getopts question
Message-Id: <36377D9C.FF169195@cardinal.co.nz>

> > > It is difficult to test for @ARGV to equal an empty list, as your non-
> >                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > just curious, why is it difficult?
> 
> s/difficult/awkward/;
> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> my @a = ();
> my @b = ();
> 
> if (@a == ()) { print "empty\n"; } # produces 'uninitialized' warning!!!
> if (@a == @b) { print "empty\n"; } # the awkward fix
> if (@a == 0)  { print "empty\n"; } # the right way, or:
> if (!@a)      { print "empty\n"; } # a neater way, or:
> unless (@a)   { print "empty\n"; } # the neatest way
> 
Accepted, but

if ( @a != () ) { print "Not empty\n"; } else { print "empty\n"; } ;

seems to work reliably in my environment (ActivePerl 502 on NT
workstation).  This is reverse logic from my pseudo-code answer however. 
Is this a case of TIMTOWTDI or a subtle side effect of the ActiveState
port ?


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

Date: Thu, 29 Oct 1998 09:35:08 +1300
From: Kelvin Price <kprice@cardinal.co.nz>
Subject: Re: getopts question
Message-Id: <36377FFC.72CA25A0@cardinal.co.nz>

> > > It is difficult to test for @ARGV to equal an empty list, as your non-
> >                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > just curious, why is it difficult?
> 
> s/difficult/awkward/;
> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> my @a = ();
> my @b = ();
> 
> if (@a == ()) { print "empty\n"; } # produces 'uninitialized' warning!!!
> if (@a == @b) { print "empty\n"; } # the awkward fix
> if (@a == 0)  { print "empty\n"; } # the right way, or:
> if (!@a)      { print "empty\n"; } # a neater way, or:
> unless (@a)   { print "empty\n"; } # the neatest way
> 
Accepted, but

if ( @a != () ) { print "Not empty\n"; } else { print "empty\n"; } ;

seems to work reliably in my environment (ActivePerl 502 on NT
workstation).  This is reverse logic from my pseudo-code answer however. 
Is this a case of TIMTOWTDI or a subtle side effect of the ActiveState
port ?


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

Date: Wed, 28 Oct 1998 13:43:08 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: getopts question
Message-Id: <MPG.10a12fc873b7b354989843@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <36377D9C.FF169195@cardinal.co.nz> on Thu, 29 Oct 1998 
09:25:00 +1300, Kelvin Price <kprice@cardinal.co.nz> says...
 ...
> if ( @a != () ) { print "Not empty\n"; } else { print "empty\n"; } ;
> 
> seems to work reliably in my environment (ActivePerl 502 on NT
> workstation).  This is reverse logic from my pseudo-code answer however. 
> Is this a case of TIMTOWTDI or a subtle side effect of the ActiveState
> port ?

I get the same "Use of uninitialized value" warning for this code as for 
the simpler code, in the same environment.  I'm surprised that you 
don't.  Do you have the '-w' flag set on the #!perl line that should be 
the first line of your program?

E:\Test>cat try.txt
#!perl -w
use strict;

my @a = ();
if ( @a != () ) { print "Not empty\n"; } else { print "empty\n"; } ;

E:\Test>perl try.txt
Use of uninitialized value at try.txt line 5.
empty

E:\Test>uname -a
Windows_NT ROSLER 4 00 586

E:\Test>perl -v

This is perl, version 5.005_02 built for MSWin32-x86-object

Copyright 1987-1998, Larry Wall

Binary build 504 provided by ActiveState Tool Corp. 
http://www.ActiveState.com
Built 14:58:28 Oct  9 1998
 ...

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


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

Date: Wed, 28 Oct 1998 21:15:29 GMT
From: pub @ alma . ch (M.)
Subject: Re: grabbing timezone withing cgi environ using perl
Message-Id: <363888c6.26038816@news.urbanet.ch>

>I need to find out what the server's timezone is.
>
>I know that I can check $ENV{'TZ'} for the server's timezone, but some 
>servers don't honor this convention.  It's also a problem inside a CGI 
>environment because most of the system environment variables are hidden.  
>I've taken a look at the Time::Timezone module from CPAN, but it relies 
>on the TZ variable to do it's work.

The best (most reliable and portable IMO) I came up with is to simply
compute it from the difference between gmtim and localtime. (That's
what I do in Mail::Sendmail).



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

Date: Wed, 28 Oct 1998 20:45:37 GMT
From: tom@netoutfit.com (Tom O'Neil)
Subject: Increasing hash value size beyond 1024 bytes in DBMs
Message-Id: <36378184.434942109@news.keyway.net>

I have an application that is using standard Perl 5 DBMs to store
message data. The problem is that the limit to any value is 1024 bytes
in the implementation that I am using. Is there another DBM
implementation or perhaps a module out there that has a higher
capacity (or maybe no limit)?

Tom
tom@netoutfit.com


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

Date: Wed, 28 Oct 1998 21:50:39 GMT
From: MBC <mcolbert@netgenics.knowspaaaamm.com>
Subject: Re: Increasing hash value size beyond 1024 bytes in DBMs
Message-Id: <3637A053.519EAA56@netgenics.knowspaaaamm.com>

sure, there's GDBM and Berkeley DB.  they have no limit on key or value
sizes.

i use Berkeley DB (http://www.sleepycat.com) with the DB_File and MLDBM
modules
(http://www.perl.com/CPAN-local/modules/by-category/07_Database_Interfaces/).

good luck.

Tom O'Neil wrote:

> I have an application that is using standard Perl 5 DBMs to store
> message data. The problem is that the limit to any value is 1024 bytes
> in the implementation that I am using. Is there another DBM
> implementation or perhaps a module out there that has a higher
> capacity (or maybe no limit)?
>
> Tom
> tom@netoutfit.com





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

Date: 28 Oct 1998 19:50:35 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Initializing a hash of arrays
Message-Id: <717sib$9qv9@mercury.adc.com>

In article <36376FBE.DE4606D0@psi.com>, Selden, Neil <seldenn@psi.com> wrote:
>Is there a way to initialize a hash of arrays at the time  you declare
>the variable?
>
>I.E. somthing akin to:
>my $var = 0;
>but would effectively initialize the entire hash?
>E.G.
>my %hash = ();
>Which I tried, but does not successfully initialize the hash.

If that doesn't do what you want, then I'm not sure what you want.
The statement above initializes %hash to be an empty hash.  

Anyway, some general things regarding arrays/hashes of
arrays/hashes... remember that a hash of arrays is actually a hash of
references to arrays.  Assignment and initialization will look
something like this.

@array = (1,2,3);
$hash{a1} = \@array;  # using an existing array
$hash{a2} = [6,7,8];  # create an anonymous array just for the occasion

%hash2 = (a1 => [1,2,3], a2 => [6,7,8]);  # %hash2 looks like %hash

Read perldsc and perllol for detailed discussions of these topics.

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Wed, 28 Oct 1998 13:20:53 -0800
From: Joseph Norris <sirron@mail.mcoe.k12.ca.us>
Subject: Is undef the best way to initialize a hash?
Message-Id: <36378AB4.33500651@mail.mcoe.k12.ca.us>

Hello Perlites,

I have seen the following ways to initialize a hash:

%my_hash = ( );

 and

%my_hash;
undef  %my_hash;

I remember reading somewhere that the undef is better. I am not sure
now. Can anyone respond to this?

Thanks to all!!!!

--
#Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
print @c=map chr
$_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
-68,4,-3,-1,7,1,14,-68,6,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);




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

Date: Wed, 28 Oct 1998 21:49:25 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Monitoring a child process.
Message-Id: <F1K4MD.A1s@world.std.com>

"Bowler, Michael (EXCHANGE:CRK:5T11)" <mkbowler@americasm01.nt.com> writes:

>Ok, now how do I tell if the child has gone defunct?  The above still returns
>true if this is the case.

How about using waitpid() with the WNOHANG option. It will return the
$pid of the process if the child has exited, and -1 if it has not.


Of course, after the waitpid() the child is no longer defunct, so it
kind of skirts around the issue;

-- 
Andrew Langmead


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

Date: Wed, 28 Oct 1998 21:15:41 GMT
From: scott@jtsmith.com
Subject: More Serial Port Problems
Message-Id: <7181ht$e0c$1@nnrp1.dejanews.com>

Well, I posted a previous question on this, and got a few replies, but none
of them seemed to really do the trick for me... I'll post the exact code
here, and if I'm doing something obviously wrong, let me know...

-----

sysopen(DEV, "/dev/ttyS1", O_RDWR|O_NOCTTY) || &access_error;

$oldh = select(DEV);
$| = 1;
select($oldh);

print DEV "$fun|$morefun|\r\n";

while (<DEV>) {
 last if ($_ =~ /\!/);
 print "$_";
 }

close(DEV);

-----


What happens:

It successfully opens the serial port, and prints that line to the port.  A
DOS-based program on the other side of the port reads that line in, and prints
out a response that ends with a !.  When this script sees that !, it quits out
of the while loop and closes the port.

That part is working OK.  However, it seems that the while (DEV) loop is
echoing eveything it receives back through the com port.  I thought the
autoflushing of the filehandle would fix this, but it doesn't, apparently.

Is there a way to keep it from echoing?  Also, is there a better way to code
this so the program doesn't freeze up on the while() loop if the serial port
is frozen up?


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 28 Oct 1998 21:10:27 GMT
From: pub @ alma . ch (M.)
Subject: Re: new to perl (maybe)
Message-Id: <363781b1.24225059@news.urbanet.ch>

>Hi, I'm comming from a total Microsoft background (NT,IIS,ASP,VC++, etc
>etc) and am considering a job which uses Perl exclusively (on NT). I'm
>confused about the functionaliy perl offers as I've never even seen the
>code.

1. Regular expressions! which means management of strings you never
even dreamed of.
2. Ease and flexibility with arrays and hashes.
3. (should really be 1.) It's a pleasure. It's not a programming
language.
("In trying to make programming predictable, computer scientists have
mostly succeeded in making it boring"
-- Larry Wall, interview in The Perl Journal, vol. 1 issue 1. )

>Does it offer similar functionality to ASP? CGI? is it for server side
>scripting only? Is there an equivalient to ASP where requests will run
>in the same process space? or is it more like CGI?

Get 2 Perls in 2 different directories: The GS port (5.004_02) for
indispensable tools like perldoc pod2html etc... and preinstalled
modules, and the ActiveState port for PerlIIS.dll (an ISAPI dll) and
PerlScript allowing you to use Perl in ASP.

>realistically, is perl becomming obsolete as more people get assimilated
>into the microsoft void?

For many tasks, there is nothing comparable to Perl. It's certainly
not becomming obsolete.

>is perl predominately a UNIX thing and does it lack functionality on NT?

Yes. And you may end up getting a Linux box to stop Windows from
getting in your way... :-)

Lacking functionality is mainly fork() and alarm(), as far as I have
been concerned. It hasn't really bothered me so far. (And there are
workarounds)

But the main point here is rather that Perl runs on Unix, Windows,
Mac, Amiga, and  I would like to port it to my dishwasher, as soon as
I find a compiler for it.

Conclusion:

- Get "Perl programming, 2nd edition" (the "Camel" book) and possibly
1 or 2 others (browse the O'Reilly shelf)
- try it out and it will be hard to get back to something else. (for
example: in VB, how do you make a collection of the strings in another
collection which contain the same word more than once?

In Perl: @new = grep /(\w+).*\1/, @old;
- Subscribe to the Perl Journal
- Have fun...




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

Date: 28 Oct 1998 20:06:57 GMT
From: dkoleary@wwa.com (Doug O'Leary)
Subject: POD syntax?
Message-Id: <717th1$97n$1@hirame.wwa.com>

Hi;

I'm working my way through O'Reily's Programming PERL book.  The syntax for 
Plain Old Documentation doesn't seem to work on my system.  If I understood the 
book correctly, the following should work:

#!/usr/bin/perl

=
Insert docs her
Insert more docs here
Insert even more docs here
=cut

print "Howdy, world\n";

That's the whole script.  When I try to run it, I get a compilation error on 
"line 3, near ="

Any ideas on what I'm messing up?

Thanks!


-- 
------------
Doug O'Leary
Senior System Administrator
dkoleary@wwa.com
dkoleary@mayspeh.com
------------



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

Date: Wed, 28 Oct 1998 16:53:06 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: POD syntax?
Message-Id: <comdog-ya02408000R2810981653060001@news.panix.com>

In article <717th1$97n$1@hirame.wwa.com>, dkoleary@wwa.com (Doug O'Leary) posted:

> I'm working my way through O'Reily's Programming PERL book.  The syntax for 
> Plain Old Documentation doesn't seem to work on my system.  If I understood the 
> book correctly, the following should work:

> #!/usr/bin/perl
> 
> =

that needs some sort of pod command

> Insert docs her
> Insert more docs here
> Insert even more docs here
> =cut

don't know which page that is on, but you can always refer to the
documentation in perlpod:

     o   A command.  All command paragraphs start with "=",
         followed by an identifier, followed by arbitrary text
         that the command can use however it pleases.  Currently
         recognized commands are

   ....


good luck

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 28 Oct 1998 20:38:56 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: POD syntax?
Message-Id: <717vd0$rkr$2@info.uah.edu>

In article <717th1$97n$1@hirame.wwa.com>,
	dkoleary@wwa.com (Doug O'Leary) writes:
: Hi;
: 
: I'm working my way through O'Reily's Programming PERL book.  The
: syntax for Plain Old Documentation doesn't seem to work on my system.
: If I understood the book correctly, the following should work:
: 
: #!/usr/bin/perl
: 
: =
: Insert docs her
: Insert more docs here
: Insert even more docs here
: =cut

>From the perlpod manpage:

    =pod

    =cut
        The "=pod" directive does nothing beyond telling the
        compiler to lay off parsing code through the next
        "=cut".  It's useful for adding another paragraph to
        the doc if you're mixing up code and pod a lot.

Greg
-- 
God does not play dice with the universe.  -- Albert Einstein
Who are you to tell God what to do?        -- Niels Bohr


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

Date: Wed, 28 Oct 1998 21:55:20 +0200
From: "Avshi Avital" <avitala@macs.biu.ac.il>
Subject: Re: problem with file test -e
Message-Id: <717suu$jfa$1@cnn.cc.biu.ac.il>


Tom Christiansen wrote in message <712nk0$ajl$1@csnews.cs.colorado.edu>...
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, breville@uoguelph.ca (Barry G Reville) writes:
>: I have a program that uses the -e file test several times to
>:check if a file exists before opening the file to write to.
>
>Using -e for such a purpose is a fundamental error.  You see, -e
>nearly always indicates that you've done something wrong by creating
>a race condition.  This is usually called a bug.  In fact, I'm *this*

a "race condition" ?
pardon my ignorence, but WTH is that?

>close to asking that -e generate a warning. :-)/2
>
>What you should be doing is something more like
>
>    sysopen(FH, $path, O_CREAT|O_EXCL|O_RDWR)


Avshalom Avital
Information Retrieval Laboratory
Bar-Ilan University, Israel
avitala@macs.biu.ac.il





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

Date: Wed, 28 Oct 1998 15:54:34 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: problem with file test -e
Message-Id: <MPG.10a14e92f5fe2e309896e9@news.scescape.net>

In article <<717suu$jfa$1@cnn.cc.biu.ac.il>>, avitala@macs.biu.ac.il 
(Avshi Avital) pounded the following:
=> Tom Christiansen wrote in message <712nk0$ajl$1@csnews.cs.colorado.edu>...
=> >In comp.lang.perl.misc, breville@uoguelph.ca (Barry G Reville) writes:
=> >: I have a program that uses the -e file test several times to
=> >:check if a file exists before opening the file to write to.
=> >
=> >Using -e for such a purpose is a fundamental error.  You see, -e
=> >nearly always indicates that you've done something wrong by creating
=> >a race condition.  This is usually called a bug.  In fact, I'm *this*
=> 
=> a "race condition" ?
=> pardon my ignorence, but WTH is that?

Using the problem above:

0) Scripts One and Two are started.
1) One checks for existence of the file foo.
1) Two checks for existence of the file foo.
2) Both one and two see the file foo it isn't there.
3) One opens the file foo.
4) Two opens the file foo.
5) One writes data to the file foo.
6) Two writes data to the file foo, overwriting one's data.

Not pretty at all. :)

=> Avshalom Avital

HTH,

--Matthew


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

Date: 28 Oct 1998 16:14:38 -0500
From: briang@access5.digex.net (Brian G.)
Subject: Re: Problem with Text::ParseWords
Message-Id: <7181fu$ga6@access5.digex.net>

In article <6uo5k7$bqs$1@news1.radix.net>,
Joseph Davidson  <jhd@saltmine.radix.net> wrote:
>Using 5.003 and Text::ParseWords I am having this problem.
>
>I use Parsewords to be able to tokenize a string around quotes.  This
>enable me to read Eudora address books for www.interguru.com/mailconv.htm,
>my addressbook conversion service.
>
>The code fails with the following input.
>
>alias "Judy\John Xxxxx" jhxxxxxB@slxx.net 
>
>with the following message

use the replace function:

	s/\\/:/g;	# Replace Backslashes with Colons

This should get rid of the backslashes.

	- Brian G.

>
>Unmatched quote at (eval 1) line 31  
>
>If I delete the slash it works.
>
>I have attempted to trap the problem by deleting the slash, but it doesn't
>work
>
>Here is the relevant code, and the output
>
>-----------------------  CODE -------------
>	print "JHD2   $_ \n";
>	s/\'//g;
>        s|/|:|g;
>        $a = tr/"/"/;
>        #@@@@
>        print "JHD3   A= $a $_ \n";
>        if (tr/"/"/%2 !=0) # to prevent unterminated quotes
>                # (which should not exist, but ocasionaly do)
>                # from terminating the script with a 500
>                # server error. The garbled line will remain
>                # garbled.
>                {
>                print "JHD1   $_ \n";
>                s/ / "/;
>                }              
>----------------------- END Code ---------------------------
>-----------------------------  BEGIN output -----------
>JHD2   alias "Judy\John Xxxxx" jhxxxxx@slxx.net
>
>JHD3   A= 2 alias "Judy\John Xxxxx" jhxxxxx@slxx.net
>
>Unmatched quote at (eval 1) line 31                                            
>
>------ END output ----------------------------------------
>note that my attempt to get rid of the slash and replace it with a colon
>does not work
>
>Thanks
>
>Joe Davidson 
>----------------------------------------------------------------------
>Joseph Davidson Ph.D.
>InterGuru -- Internet Engineering
>Perl/CGI, E-mail address list conversion service
>1501 Dublin Drive, Silver Spring, Md. 20902
>voice 301 593 4152 ; fax 301 593 2541
>jdavidson@interguru.com, http://www.interguru.com
>----------------------------------------------------------------------




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

Date: Wed, 28 Oct 1998 08:20:37 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Reg. expr. question
Message-Id: <l79717.hci.ln@flash.net>

Kjetil Svendsberget (kjetil@balder.no) wrote:
: I want to convert:

: f:\temp\test\

: unto:

: f:/temp/test/


: How can i do this in 1 operation?


      $dest_dir =~ s#\\#/#g;


   Or, since you are substituting individual characters, this
   would be better:

     $dest_dir =~ tr#\\#/#;


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 28 Oct 1998 20:36:32 GMT
From: amatot@my-dejanews.com
Subject: Simple regular expression (HELP).....
Message-Id: <717v8g$abv$1@nnrp1.dejanews.com>

Hi,

Could someone help me with this. I'm sure it's easy, but I can't get it to
work. All I won't to do is create a regular expression that searchs a string
for the first occurance of a double quote (") or the end of line (which ever
comes first) and substitutes everything up to but not including the double
quote or new line. Can one expression cover both case? For example:

string1 = @(#)this is a string"; /* comment */
string2 = @(#)this is another string   /* comment */
string3 = @(#)%Z% %M%

If strings 1 and 2 where given to the reqular expression (using string 3 as
the replacement string) you would get:

string1 = @(#)%Z% %M%"; /* comment */
string2 = @(#)%Z% %M%

Any help would be great.

Tom

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 28 Oct 1998 21:03:18 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Simple regular expression (HELP).....
Message-Id: <7180qm$bh12@mercury.adc.com>

In article <717v8g$abv$1@nnrp1.dejanews.com>,  <amatot@my-dejanews.com> wrote:
>Hi,
>
>Could someone help me with this. I'm sure it's easy, but I can't get it to
>work. All I won't to do is create a regular expression that searchs a string
>for the first occurance of a double quote (") or the end of line (which ever
>comes first) and substitutes everything up to but not including the double
>quote or new line. Can one expression cover both case? For example:
>
>string1 = @(#)this is a string"; /* comment */
>string2 = @(#)this is another string   /* comment */
>string3 = @(#)%Z% %M%
>
>If strings 1 and 2 where given to the reqular expression (using string 3 as
>the replacement string) you would get:
>
>string1 = @(#)%Z% %M%"; /* comment */
>string2 = @(#)%Z% %M%

$string1 =~ s/[^"\n]*/$string3/;

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Wed, 28 Oct 1998 16:52:16 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Syntactic flexibility (was: Re: psychology of language choice (was Re: language war ...))
Message-Id: <36379210.D575387@min.net>

Dave Kirby wrote:
> 
> I dont know Scheme or Guile, but you can certainly add new language
> constructs to TCL or FORTH.

Yes indeed.  Perfect examples!


> >I think it's cool that in Perl I can do things like this:
> >
> >       @result = map2
> >         {
> >           my( $x, $y ) = @_;
> >           $x << 8 + $y        # some sample function of (x,y)
> >         }
> >           [ 4, 5, 6 ],        # the x values
> >           [ 1, 2, 3 ];        # the y values
> 
> Is map2 a recent addition to the perl language or a user defined
> function?

It's one that I could write in Perl.  That's the point.


> You have been able to do the same in python all along:
> 
> >>> map( lambda a, b: a<<8 + b, [4, 5, 6], [1, 2, 3] )
> [2048, 5120, 12288]

Very neat.  Very enviable.
Although, it looks like it iterates once over all the vectors, in parallel.
What if you wanted to iterate over the cartesian product?
That's what I had in mind, but it could have been anything.


> This may seem like nit-picking, but it illustrates how easy it is to
> test code interractively in python.

Well, I didn't test the code I posted, but not because it isn't easy.
The perl "debugger" is actually a very nice full-featured* interactive 
development environment.

*text-only; no windows. ;-)

John Porter


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

Date: Wed, 28 Oct 1998 21:29:02 GMT
From: hippie@net-alert.com
Subject: Re: system() function on PERL for Win32
Message-Id: <7182au$evs$1@nnrp1.dejanews.com>

There does indeed appear to be a problem with the system() function in the
Gurusamy Sarathy distribution for Win32, as of 5.004_02.

C:\>perl -e "system('type \\autoexec.bat');"

produce "Invalid switch" before giving me the output, while

C:\>perl -e "print `type \\autoexec.bat`;"

works fine.


Meanwhile, anyone figured out what makes Net::Ping behave so erratically under
Linux?  I posted earlier with details, and got the auto-responder message, but
my post never showed up on DejaNews...

--
Jim Davis
http://www.net-alert.com/hippie/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 28 Oct 1998 15:35:23 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Where are Tom Christiansen's Perl Style Slide Files?
Message-Id: <MPG.10a14a11c9422bb19896e8@news.scescape.net>

In article <<363742C5.162EABA4@mail.tju.edu>>, 
george.kuetemeyer@mail.tju.edu (George Kuetemeyer) pounded the 
following:
=> The subject says it all. I looked at the slides a while back via a link
=> at www.perl.com. The link now appears to have disappeared, and search
=> engines turn up an invalid host address. I thought the slides were
=> really useful & am hoping that they are still available.

http://www.perl.com/CPAN-local/doc/FMTEYEWTK/style/slide-index.html

=> TIA.

HTH,

--Matthew


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

Date: 28 Oct 1998 20:40:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Where are Tom Christiansen's Perl Style Slide Files?
Message-Id: <717vgg$k3q$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, George Kuetemeyer <george.kuetemeyer@mail.tju.edu> writes:
:The subject says it all. 

    http://language.perl.com/style/

--tom
-- 
    There is, however, a strange, musty smell in the air that reminds me of
    something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
        --Larry Wall in Configure from the perl distribution


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4095
**************************************

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