[6912] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 537 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 29 05:08:51 1997

Date: Thu, 29 May 97 02:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 May 1997     Volume: 8 Number: 537

Today's topics:
     (Q): Printing paragraphs of a file, randomly <eermmb@engunx.unl.edu>
     ---: Basic Perl question! Please HELP :---------------- (Farshad Abasi)
     Re: any editor for perl? (Brian Orpin)
     Anyone knows how to mirror ftp site ..using perl on NT? yolcu@nownuri.net
     Cum visit our free BBS (Steph & Lise)
     Date Comparisons <jcokos@surfr.com>
     Re: Date Comparisons (Tim  Smith)
     Re: From Unix Perl programming to NT Perl Programming.. (Scott McMahan)
     getopt examples <toml@synnet.com>
     Re: Help w/ associative arrays (Tad McClellan)
     How to directly interact with a cgi-script somewhere on <walter@swiftech.com.sg>
     Re: How to extract text enclosed by... <flg@vhojd.skovde.se>
     Idiom for list summation? (Craig Berry)
     Re: Idiom for list summation? <dehon_olivier@jpmorgan.com>
     Re: Idiom for list summation? (Tim  Smith)
     Re: Inheritance help (Hope this helps!)
     Re: libwww GET problem <jsoloff@psu.edu>
     Re: long -> short file names with NT-Perl (R Bradley)
     Re: long -> short file names with NT-Perl (Scott McMahan)
     Re: LWP: can't find DESTROY.al? (Chipmunk)
     Re: Magical Auto-increment operator (Hope this helps!)
     Re: Mass emailing (Geoffrey Hebert)
     problem searching fielded data (David S. April)
     Re: PURE PERL .gif creating library needed; not in @#$  (Abigail)
     Re: Standalone web database for Perl? (Danny Aldham)
     String comparsion <kmleung@fg702-6.abct.polyu.edu.hk>
     Re: String comparsion (Tim  Smith)
     Submit form via script? <scott@moriah.com>
     Re: Submit form via script? (Tim  Smith)
     Text wrapping in variable? <scott@moriah.com>
     Re: Text wrapping in variable? (Tim  Smith)
     What does main' in sub main'routine do? (Dinh Le)
     Re: Where can I get Net::FTP? (Abigail)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 28 May 1997 17:55:33 -0500
From: Daneshjoo <eermmb@engunx.unl.edu>
Subject: (Q): Printing paragraphs of a file, randomly
Message-Id: <Pine.OSF.3.95.970528174138.9781A-100000@engunx.unl.edu>

Hi :

	I have been trying to write a script to read a file, which
contains paragraphs and are seperated either by a blank space
or each paragraph is numbered, and print a paragraph randomly.  But
unfortunately I haven't been able to do it.  Could some one please help me
out.  TIA

 
				Daneshjoo

			eermmb@engvms.unl.edu
			



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

Date: 28 May 1997 22:59:48 GMT
From: fabasi@unixg.ubc.ca (Farshad Abasi)
Subject: ---: Basic Perl question! Please HELP :-----------------
Message-Id: <5midd4$l6g$1@nntp.ucs.ubc.ca>

Hello,

Is this a valid call to a PERL script? I am not having any luck with it :-(

<frame src="test.cgi" name=body>

My script runs OK from the shell (ie if I type "perl test.cgi" it generates the 
page OK, but if I go to the web browser and try the script off my server (ie 
http://myurl.com/test.cgi) then nothing works.

This test.cgi is a VERY basic script just sptiing a sample html page using 
several print calls. So what I want it to do is to set up HTM in one of my frames...

--
       -Farshad
"and remember in your brain boggle, wrong starts with a wubble-u"
main email: fabasi@unixg.ubc.ca
alt. e-mail: x7l1@ugrad.cs.ubc.ca


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

Date: Thu, 29 May 1997 07:23:25 GMT
From: brian.orpin@gecmX.com (Brian Orpin)
Subject: Re: any editor for perl?
Message-Id: <338f2edf.1259727@news.geccs.gecm.com>

On Tue, 27 May 1997 22:49:27 +0800, ccm <biceps@hkstar.com> wrote:

>I am a new user in Perl.
>I found that those .pl files edited under Win95/Dos Editor will not work
>properly.
>But if I edit them in the unix shell with pico, they works fine.
>is out there any editor which workable with perl under Win95/Dos
>Environment?

Try Programmers File Editor (PFE).  It will handle any size file and
save in UNIX format.  It can be configured to send a file directly to
Perl and capture the resultant output.
http://www.lancs.ac.uk/people/cpaap/pfe


--
Brian Orpin    (These thoughts are my own ......... for once!)
brian.orpin@gecmX.com or BrainOrpin@BigfootX.com  
http://www.borpin.demon.co.uk/  **Anti-spam reply-to remove X**


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

Date: 28 May 1997 18:55:57 -0700
From: yolcu@nownuri.net
Subject: Anyone knows how to mirror ftp site ..using perl on NT?
Message-Id: <5minnd$3dp@drn.zippo.com>


hi!
I wanna know how to mirror ftp site ...using perl
 ..on NT 4.0(on IIS ftp server)
is there any mirroring script for NT...?...if so,
please let me know the URL that has the script..!!
thanks.

yolcu@nownuri.net


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

Date: Wed, 28 May 1997 20:40:47 GMT
From: stephlise@telco.com (Steph & Lise)
Subject: Cum visit our free BBS
Message-Id: <336b0fe1.6519487@hiroken.hiroken.or.jp>

Free Adult Internet Connection Worldwid- Via Our Bbs.
Follow the link and enjoy...
http://cybercity.hko.net/la/interbbs/freenet/free.htm





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

Date: Thu, 29 May 1997 02:26:23 -0400
From: John Cokos <jcokos@surfr.com>
Subject: Date Comparisons
Message-Id: <338D218F.1D73@surfr.com>

I'm trying to do a date comparison, if you can help, I'd appreciate it.
BTW, this message is pretty long, but I tried to give as much detail as
possible.  Thanks.

I have an ascii file which I'm using as a "database" with the following
format:
==NEW RECORD==
<Output of `date` command>
Someone's Name
Someone's Order #
Someone's Account #
 ...
==END RECORD==

I'm using the following code to read in the file:
  open HDR,"$order_file";
    while ( <HDR> ) {
      $records={};
      foreach $record(split /==END RECORD==\n/,join '',<HDR>){
	(undef,
	 @{$records[$count++]}{qw(entry_date name ord_no acct_no
 ...)})=split(/\n/,$record,9);
      }
    }
  close (HDR);
  @entries = sort { $a->{'acct_no'} <=> $b->{'acct_no'} 
  	or $b->{'ord_no'} <=> $a->{'ord_no'} } @records;

  
I can access the records by using this type of code
$this_date = $entries[0]{'entry_date'};

I want to be able to delete entries that are 30+ days old.
How do I compare the date in the record to the current date?


Thanks In Advance...

John Cokos


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

Date: 29 May 1997 01:02:57 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Date Comparisons
Message-Id: <5mjd7h$9h5@web.azstarnet.com>

In article <338D218F.1D73@surfr.com>, John Cokos  <jcokos@ccs.net> wrote:
>I'm trying to do a date comparison, if you can help, I'd appreciate it.
>
>I have an ascii file which I'm using as a "database" with the following
>format:

[ ... ]

>I can access the records by using this type of code
>$this_date = $entries[0]{'entry_date'};
>
>I want to be able to delete entries that are 30+ days old.
>How do I compare the date in the record to the current date?

John,

You might be looking for the Time::ParseDate module.  It returns the
number of seconds since 1970, just like time() does.  So, you do:

my $now = time();
my $then = parsedate($this_date);

if ($now - $then > 30 * 24 * 60 * 60) {
    # delete old file
}

Enjoy,

Tim



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

Date: 28 May 1997 17:31:48 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: From Unix Perl programming to NT Perl Programming... Help!
Message-Id: <5mhq64$mtn$1@mainsrv.main.nc.us>

Daniel Schnaider (snaider@galcom.co.il) wrote:

: I a Unix Perl programmer.
: I am trying to make a program in Perl for NT that send me mail after it
: checks some things...
: I dowloaded a program called postmail that suppose to send mail using
: pipe.
: It doesn't seem to work!

Bummer. You ought to get in the beta test program for my new Automail
program. It works, because I use it all the time!

Scott


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

Date: Mon, 26 May 1997 13:56:36 -0400
From: Tom Lynch <toml@synnet.com>
Subject: getopt examples
Message-Id: <3389CED4.2897@synnet.com>

Greeting:

	I am looking for an example of getopt () which will 
	should how to error out if a switch which was not 
	defined is on the command line. I have checked
	perldoc and Deja news but no examples. What I am 
	trying to do is if the user types -v and I have:

	getopt ('p:');

	I would like to error out saying "-v" unknown switch.

	Thanks for any help in advanced.

	Tom


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

Date: Wed, 28 May 1997 23:03:30 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help w/ associative arrays
Message-Id: <i6vim5.cpf.ln@localhost>

Hans Mulder (hansm@icgned.nl) wrote:
: tadmc@flash.net (Tad McClellan) wrote:

: >: > '01' is interpreted in decimal

: >It is a string.


Because it is in single quotes.


: >If a number is needed, then perl converts the string using the 
                                                        ^^^^^^^^^
: >atoi() C function.
   ^^^^^^^^^^^^^^^^^

: >I looked around a little in the *.pods. Couldn't really find anything
: >that says this. Maybe I just remember if from the Camel or Llama,
: >I didn't check those.

: It's in perlfaq4.pod:
  ^^
  ^^


I think we are discussing different "it"s ;-)

I was trying to find the underlined part above in the docs somewhere.



: =head2 Why isn't my octal data interpreted correctly?

[ snip FAQ snippet ]


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 29 May 1997 04:51:00 GMT
From: "Walter Klomp" <walter@swiftech.com.sg>
Subject: How to directly interact with a cgi-script somewhere on a server?
Message-Id: <01bc6beb$e780dd40$78ec2aca@walter.swiftech.com.sg>

Hi,

I am trying to make an interface using a perl-script to submit a form by
telnetting into a web-server on port 80 and then submitting a request to a
script which only accept the POST method.

the web-form is something like this...

<FORM METHOD=POST ACTION="xxx.cgi?type=yyy">


and then there are 2 more variables posted... 

How do I do this directly from a perl-script ?

if I telnet into the machine and I type

GET xxx.cgi?type=yyy&var1=zzz&var2=aaa

apparently the var1 and var2 never come over, neither does it work when I
do a POST xxx.cgi ...

Is there anybody out there who can enlighten me on what exactly transpires
between a web-client and a server on a POST method submission ?

Thank you very much for any helpful response.

Warmest Regards
Walter


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

Date: 29 May 97 06:27:00 GMT
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Re: How to extract text enclosed by...
Message-Id: <01bc6bf9$54287ea0$e20f10c2@odens.di.vhojd.skovde.se>

CHAN TANG Eric-Aubert <chantane@JSP.UMontreal.CA> wrote in article
<5mi09i$q9t@epervier.CC.UMontreal.CA>...
> 
> How can I extract text enclosed by some strings.
> 

You could use a regexp to extract the text. 

/BEGIN_PATTERN(.*?)END_PATTERN/;

BEGIN_PATTERN and END_PATTERN are of course the text we want to 
surround the text. The text we want to catch are surrounded by parens
and the regexp uses a nongreedy match. For more information about
regexps check out the man page perlre

Here is an example using this technique

#!/usr/bin/perl -w
#
$text = 'This is a (sample ( text) string)_) for example.';

if ($text =~ /\((.*?)_\)/) {
    print "Its <$1>\n";
} else {
    print "Not Found\n";
}

__END__

Hope this helps

/Fredrik


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

Date: 29 May 1997 05:15:15 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Idiom for list summation?
Message-Id: <5mj3d3$et7$1@marina.cinenet.net>

I have the need to take a list of numbers and determine their sum.  I can 
easily to this with code like this:

  @nums = ( 1, 2, 3, 4 );
  $sum  = 0;

  foreach $n (@nums) {
    $sum += $n;
  }

However, I can't shake the nagging feeling that there must be an easier 
way, using a 'map' or something like that.  Any suggestions?

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 29 May 1997 08:50:05 +0100
From: Olivier Dehon <dehon_olivier@jpmorgan.com>
Subject: Re: Idiom for list summation?
Message-Id: <njzsoz6ogya.fsf@jpmorgan.com>

cberry@cinenet.net (Craig Berry) writes:

> 
> I have the need to take a list of numbers and determine their sum.  I can 
> easily to this with code like this:
> 
>   @nums = ( 1, 2, 3, 4 );
>   $sum  = 0;
> 
>   foreach $n (@nums) {
>     $sum += $n;
>   }
> 
> However, I can't shake the nagging feeling that there must be an easier 
> way, using a 'map' or something like that.  Any suggestions?

You almost had it. It's fairly easy to translate the foreach construct
into a map construct :

map {$sum += $_} @nums;

Check out the perlfunc manpage for more details about the map function.

Hope this helps.

Olivier Dehon.


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

Date: 29 May 1997 01:11:08 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Idiom for list summation?
Message-Id: <5mjdms$ad4@web.azstarnet.com>

In article <5mj3d3$et7$1@marina.cinenet.net>,
Craig Berry <cberry@cinenet.net> wrote:
>I have the need to take a list of numbers and determine their sum.  I can 
>easily to this with code like this:

[ ... ]

>However, I can't shake the nagging feeling that there must be an easier 
>way, using a 'map' or something like that.  Any suggestions?

I don't know if this is "easier" or not...

#!/usr/bin/perl -w

my @nums = (1, 2, 3, 4, 5);
my $sum = eval join ' + ', @nums;
die $@ if $@;
print "Sum is: $sum\n";
exit 0;


Tim



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

Date: 29 May 1997 00:44:43 -0500
From: scribble@wwa.com (Hope this helps!)
Subject: Re: Inheritance help
Message-Id: <5mj54b$i7c@shoga.wwa.com>

In article <umgroner.864851882@bova>,
>When I run a script that uses "MY_CGI" I get the error,
>"Can't locate object method "new" via package "MY_CGI" at test.pl line 2."
>
>The beginning of MY_CGI.pm has:
>package MY_CGI;
>@ISA = qw(CGI);
><some new methods and an overridden method>

You might have forgotten to say "use CGI" in MY_CGI.pm.

Just a guess...



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

Date: Thu, 29 May 1997 00:18:04 -0400
From: "Jason A. Soloff" <jsoloff@psu.edu>
To: Matthew Burnham <danew@enterprise.net>
Subject: Re: libwww GET problem
Message-Id: <338D037C.650D24C3@psu.edu>

> 
> >I think there is a problem in the configuration for the TCP/IP
> >networking on the problem machine, but am not sure where to look
> >for it.  I don't have enough access to poke around, but would
> >appreciate any advice as to where to direct my sysadmin.

> Does incoming work? ie. is the machine a website?
> 

No.  Nothing seems to work.  Neither my code, the "demo" programs
with libwww, or the client and server programs from the "camel" 
book.  When you run "server" (from the book), using just a perl
socket call, it gets all the information addresses, protocols, etc,
but when you actually call socket() the response is that the
protocol (in this case tcp) is not supported.

The machine does work as a web server at another level, and both
netscape and x-mosaic work fine from the user level.

Any ideas where to look?

Jason


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

Date: 28 May 1997 18:21:09 GMT
From: rick@rentec.com (R Bradley)
Subject: Re: long -> short file names with NT-Perl
Message-Id: <5mht2l$g31@puma.rentec.com>

Rob Lucier (rlucier@innerlogic.com) wrote:
: I am trying to convert long file names (Win95/NT format) to the DOS 8.3
: equivalent. My eventual goal is to call the dos version of pkzip (the
: version I have only understands 8.3) with a command-line statement to
: compress multiple files. 
: Either of two distinct pieces of information would solve this problem:
: 	1. How to convert long file names to 8.3 in PERL
: 	2. NT-Zip software that takes long file names in the command line.
: I appreciate any help, hints or advice that people have on this problem.
: Rob Lucier
: InnerLogic

This turns out to be a fairly interesting problem (we actually did some
research on this (as an abstract theory problem) when we came across it).
We (my advisor and I (at Stony Brook)) needed to put out a CD-ROM in
ISO-9660 format, but the filesystem we were using was on a SunOS machine.
This means we needed to go from arbitrary filenames to 8.3 filenames.
To further complicate matters, much of the filesystem was HTML which 
would break if the underlying file names were changed.

We ultimately solved the problem by writing a Perl application which 
does the renaming and redirected the HTML links in a second pass.

The strategy was as follows:

1 - start at the top of the directory structure
2 - consider the file names in the current directory:
        a - convert all characters not in [A-Z_] to [A-Z_] by some simple
	    rules
	b - can they be blindly truncated and not conflict with each
		other?
		YES:  truncate them, and put the old filename/new
			filename combination in a hash
		NO:   rename them intelligently (see below) and put
			the old filename/new filanem combination in 
			the same hash
3 - for each subdirectory, recursively perform (2) above.

The "intelligent" renaming goes something like this:
1 - construct a weighted bipartite graph (here's where the "theory"
	jargon gets thrown in, but it's pretty light) where the 
	nodes on the "left" side of the graph represent the original
	filenames, the nodes on the "right" side of the graph
	represent suggested new file names, and the edges between
	two nodes represent the favorability of the corresponding
	new file name.

	the suggested new file names consist of things like:
	1 - the original filename truncated to 8.3 (blindly)
	2 - the original filename with contiguous substrings
		removed
	3 - the original filename truncated with unique numbers appended
	4 - a distinct number (0000001, 00000002, etc.) for each
		filename
	and so on -- some suffixes like .tar.gz get changed explicitly
	(.tgz), and there are some additional suffix rules, and rules 
	for filenames with multiple '.'s and no '.'s.

2 - pass the bipartite graph to standard weighted bipartite matching
	solver and get back the results
3 - process the results into old-filename -> new-filename mappings
	and save these in the hash discussed above.

When this has finished we passed back through the html files and
redirected all the links we were interested in (IMG, HREF, etc.).
This was tricky since there are absolute and relative links ...
This was actually during the recursive pass where we renamed all the
files to their new names (using the hash above).

Most of the PKzip-ish programs we looked at (to see if this had been
done before) were relatively naive -- generally attempting to truncate the
names of the files to 8.3 and croaking when there is a collision.
M$-Windoze-95/NT seem to use pretty naive (and ugly) truncation schemes, 
where a lot of '~' characters and index numbers appear.

I'm sorry that the code isn't in the public domain as of yet (we're in
the midst of writing a technical paper with statistics, and some
experiments on access times with CD's with different directory sizes, 
as the program above also split directories to contain no more than 
k files per directory as it did its renaming), but it may be available
relatively soon (couple of months) -- presumably for free.

Rick Bradley


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

Date: 28 May 1997 17:53:04 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: long -> short file names with NT-Perl
Message-Id: <5mhre0$mtn$2@mainsrv.main.nc.us>

Rob Lucier (rlucier@innerlogic.com) wrote:
: 	1. How to convert long file names to 8.3 in PERL

Generate your own 8.3 names and copy or rename the files
yourself. A clever perl programmer could write an index
file and an un-8.3 script for the other end.

: 	2. NT-Zip software that takes long file names in the command line.

Why not use InfoZip's newest zip & unzip versions that support LFNs?

Scott




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

Date: 29 May 1997 05:10:32 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: LWP: can't find DESTROY.al?
Message-Id: <5mj348$1to$1@dartvax.dartmouth.edu>

In article <338B8291.6BFA@ixlabs.com>
Chris Schoenfeld <chris@ixlabs.com> writes:

> I have this simple subroutine I use for LWP HTML get's. Well,
> I loaned it to my boss, who plugged it into a large script, and he 
> gets the following warning (although everything works):
> 
> Can't locate auto/LWP/UserAgent/DESTROY.al in @INC at
> /usr/local/lib/perl5/AutoLoader.pm line 26.

Compare the elements in @INC between your script and your bosses
script.

Chipmunk


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

Date: 29 May 1997 01:10:13 -0500
From: scribble@wwa.com (Hope this helps!)
Subject: Re: Magical Auto-increment operator
Message-Id: <5mj6k5$lsl@shoga.wwa.com>

In article <338CB57E.5C0A@electriciti.com>,
Rob Perelman  <robp@electriciti.com> wrote:
>Tushar Samant wrote:
>> [a-zA-Z]*[0-9]* words are manifestly not numbers when they
>> contain non-numerics.
>
>OK, then explain why '3/9' and '9z' are treated as numbers.

I don't know. The man in the uniform said so.

>According to Perl, it's a number.  But it contains non-numerics.

Maybe that's why the documentation sticks to the familiar
terrain of [a-zA-Z]*[0-9]*.

>> What does "9z" increment to? [...] If you say "10a", it's as
>> intuitive as "9aa".
>
>        [...]  it becomes "10a".  True, "9aa" is just as valid,
>but in my logic, I say a character gets added at the leftmost
>part of the string if anything needs to be added.

But there is no "character getting added" anywhere when "9z"
changes to "10a". It's two characters getting replaced with
three totally different ones.

Now you may think that I know very well what you mean. Well,
I don't. I know what a number increments to, that's it. Angels
on pinheads, I have no conjectures about.

>Well, I guess I'm just too lazy to split apart 'cs2#09', increment the
>latter part, and then join it back together.

There you lie. You showed admirable industry in writing the
"plusplus" function.

>Besides, the entire reason I am bringing this issue up is because I
>want to say:
>
>	@lines = ('cs2#09' .. 'cs2#16');
>
>And it just won't work.

Don't get me wrong. I understand why you want your auto-tantric
increment. I am just saying it can be done with less effort than
a change in Perl.

>For now, I say:
>
>	@lines = map("cs2#$_", '09' .. '16');
>
>But that is grossly inefficient and ugly.

I think it's unutterably beautiful. I have scarcely set my eyes
on anything lovelier.



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

Date: Thu, 29 May 1997 03:31:31 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: Mass emailing
Message-Id: <5mis52$im$1@news3.microserve.net>

This may be your lucky day.

I do a mass mailing from a file.  I only have used 10-50, but I know
of no reason why it would not work for many more.

I just rebuilt my test site.  A perl cross reference is being
developed.  As an example, the script you want is there.

Follow the instruction below - use password perlmisc
Follow perl cross reference path.  
select email.cgi

This is my script you may use it or any part of it.

Hope this helps.
-------  signature  ----------

Check out the Perl site! (in development)

http://www.microserve.net/~soccer/
(yeh, who would have guessed perl)

use password perlmisc

Will be GREAT tool for Developers (when complete)



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

Date: Thu, 29 May 1997 02:06:39 -0600
From: april@igcom.net (David S. April)
Subject: problem searching fielded data
Message-Id: <april-2905970206390001@april.xnet.com>

I'm having trouble with a search script I'm trying to write that processes
fielded data. I want to take up to five search criteria and return records
that match all the given criteria.

My idea in the "foreach" loop below was to have a good record "fall
through" all of the "next" statements. 
If a searchKey was undefined for "last", test1 would fail and the script
would proceed to test2 and so on.
If a searchKey was defined for last", but didn't match the pattern, test1
would fail and the script would proceed to test2 and so on.

test2 (and the rest, presumably) always cause the "next" statement to
execute and I am nenver finding any matches.

What am I doing wrong?

Thanks in advance!

# ------ begin sample code ----

  $,="\n";
  $srchKeys{'last'}="smi";  # only search field defined this time

  @lines=&file2Array($db); # $db is a pipe delimited text database
  
  foreach $line (@lines) {

   ($first,$mid,$last,$org,$tit,$wkPh,$cellPh,$hmPh,$null,$addr,$city,$stat
e,$zip)=
     
split('\|',$line);                                                                                                 
# split into fields

   next unless defined $srchKeys{'last'} and $last =~
/$srchKeys{'last'}/io;              # test1

   print $line if /smi/;   # this line will print for the 2 records in the
database that have "smith" as the last name for example.

   next unless defined $srchKeys{'first'} and $first =~
/$srchKeys{'first'}/io;          # test2
   next unless defined $srchKeys{'org'} and $org =~
/$srchKeys{'org'}/io;                # test3

   print $line; # this line matches all the search criteria - but I never
get here.

   push(@matches,$line);
  }
  
  print @matches;

# ------ end sample code ----

Dave

-- 
David S. April               Syclo LLC
april@igcom.net            101 Lions Dr - Suite 118
(847) 842-0320            Barrington, IL 60010

"Paradise is exactly like where you are right now, only much, much *better*."
    - Laurie Anderson


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

Date: Thu, 29 May 1997 04:07:31 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: PURE PERL .gif creating library needed; not in @#$ C language or external modules.  PERL!
Message-Id: <EAxCsJ.LMx@nonexistent.com>

On Wed, 28 May 1997 21:36:33 GMT, Ronald L. Parker (ron@farmworks.com) wrote
in comp.lang.perl.misc,comp.lang.perl.modules
<URL: news:338ca4d6.31750678@10.0.2.33>:
++ On Wed, 28 May 1997 02:30:20 GMT, abigail@fnx.com (Abigail) wrote:
++ 
++ >I don't understand what's against using existing (C) modules.
++ 
++ Well, there's the little thing called "using someone else's web 
++ server."  Our Web provider doesn't provide a C compiler.  I don't have
++ access to the same architecture anywhere else.  I think an all-Perl 
++ GIF library would be nice, too, if it could be gotten to run quickly.

Then use GCC and cross-compile.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: 28 May 1997 21:47:09 -0700
From: danny@hendrix.postino.com (Danny Aldham)
Subject: Re: Standalone web database for Perl?
Message-Id: <5mj1od$2fo$1@hendrix.postino.com>

Gary Weinfurther (gary@mich.com) wrote:
: A client wants a "simple" database application developed in Perl for a 
: corporate intranet.  According to the client, the web server does not 
: currently have a DBMS.  He wants a small, low-budget database for this 
: application and it does not need to interact with any other application 
: on the intranet.  Is there a Perl library that manages database records, 
: similarly to a data management library for C or other languages?  Or do 
: we have to purchase a large C/S RDBMS and install it on the server?

You don't say what platform you are on. Assuming unix, there are
a couple of free or Public Domain Databases you might want to check
out. MiniSQL and Postgresql both work well, and both have perl modules
to make interfacing with them easier. Do a search at altavista .

--
Danny Aldham    SCO Ace, MCSE    www.postino.com


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

Date: 29 May 1997 05:31:26 GMT
From: "Alexander K. M. Leung" <kmleung@fg702-6.abct.polyu.edu.hk>
Subject: String comparsion
Message-Id: <01bc6bf1$f5641ac0$0e1f849e@fg702-4.polyu.edu.hk>

Hi,

	I want to use Perl to develop a small utility in my SGI workstaiton. Such
utility will have a menu with 3 options (A, B, C). How can I use a if
statement to detect which option is chosen.

	I have try the following script, but it is not work.

$option=<STDIN>
if ($option="a") {
     :
} elsif ($option="b") {
     :
} elsif ($option="c") {
     :
}

	How can I modify this script? Thanks.
-- 
           ///
          {. .}  ~~~~ My name is Alexander K. M. Leung 
_______oOO-(_)-OOo_______HKPolyU Dept. Appl. Bio. & Chem. Tech._____
           <->              kmleung@fg702-6.abct.polyu.edu.hk
                    URL: http://fg702-6.abct.polyu.edu.hk/~kmleung


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

Date: 29 May 1997 01:16:46 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: String comparsion
Message-Id: <5mje1e$c00@web.azstarnet.com>

In article <01bc6bf1$f5641ac0$0e1f849e@fg702-4.polyu.edu.hk>,
Alexander K. M. Leung <kmleung@fg702-6.abct.polyu.edu.hk> wrote:
>	I have try the following script, but it is not work.
>
>$option=<STDIN>
>if ($option="a") {
>     :
>} elsif ($option="b") {
>     :
>} elsif ($option="c") {
>     :
>}

`=' is the assignment operator, not equality.  You were thinking of
`==', but that is numeric equality, not string equality.  You really
want to use:

if ($option eq "a") { ... }

But $option still has the newline at the end, so you need to chomp() it
first:

chomp($option = <STDIN>);
if ($option eq 'a') { ... } elsif ($option eq 'b') { ... }

Read the perlop(1) man page for more info on equality tests.

Tim



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

Date: Wed, 28 May 1997 02:09:36 -0700
From: Scott Crumpton <scott@moriah.com>
Subject: Submit form via script?
Message-Id: <338BF650.3CD4@moriah.com>

Question: +++++++++++
Is it possible to submit a form via a script instead of having to
"click" on a submit button?

Background (fluff!): +++++++++++
We are adding 500+ of our clients pages to many of the search engines. I
have already written a script which gathers descriptions and the like
from their pages on our site and then presents me with a list of buttons
from each of the search engines.

However, it makes more sense to me to click one button and have a script
submit all the forms. Taking this a step further, I could simply give a
list of URL's to the script and let it do the work.

Possible?

Would either Post or Get cause any additional trouble? I'm using Perl.

Thanks in advance.
scott@moriah.com


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

Date: 29 May 1997 01:31:16 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Submit form via script?
Message-Id: <5mjesk$ek3@web.azstarnet.com>

- CC'd to poster -
In article <338BF650.3CD4@moriah.com>,
Scott Crumpton  <scott@moriah.com> wrote:
>Question: +++++++++++
>Is it possible to submit a form via a script instead of having to
>"click" on a submit button?

Look on CPAN for the LWP::UserAgent module.  It makes this kind of
thing pretty easy.

Tim



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

Date: Wed, 28 May 1997 02:10:56 -0700
From: Scott Crumpton <scott@moriah.com>
Subject: Text wrapping in variable?
Message-Id: <338BF6A0.6ABD@moriah.com>

Quick question:

What is the proper way to assign a long text string to a variable.

Using MacPerl, this works fine but gives an error under Unix.

$foo = "This is a sample text string that
wraps because of my window size";

Thanks in advance,

scott@moriah.com


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

Date: 29 May 1997 01:36:46 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Text wrapping in variable?
Message-Id: <5mjf6u$g9u@web.azstarnet.com>

In article <338BF6A0.6ABD@moriah.com>,
Scott Crumpton  <scott@moriah.com> wrote:
>Quick question:
>
>What is the proper way to assign a long text string to a variable.
>
>Using MacPerl, this works fine but gives an error under Unix.
>
>$foo = "This is a sample text string that
>wraps because of my window size";

Scott,

This should work under Unix, too.  Make sure that you're FTP'ing your
file up as ASCII text, not binary data.  Better yet, use a text editor
like vi to create your perl file.  Some editors put lots of surprise
characters into your files.

If it's a really long string, use the 'here-is' document syntax:

$foo = <<"XXX";
This is a sample text string that
wraps because of my window size
XXX

Tim



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

Date: 29 May 1997 05:58:25 GMT
From: dinh@yi.cs.ucla.edu (Dinh Le)
Subject: What does main' in sub main'routine do?
Message-Id: <5mj5u1$8sv@delphi.cs.ucla.edu>

Hi,

I am trying to debug a perl program that declared a subroutine as:

	sub main'routine {
	  <BODY>
	}

In a different file, the subroutine main'routine is referred to
as &routine.  Can someone tell me the purpose behind the prefix
main'?

			Thanks,

			Dinh
			dinh@cs.ucla.edu


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

Date: Thu, 29 May 1997 01:59:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Where can I get Net::FTP?
Message-Id: <EAx6vp.B1M@nonexistent.com>

On 28 May 1997 19:40:15 GMT, Robert Chapman (robc@no_spam!_igs.net) wrote in
comp.lang.perl.misc
<URL: news:5mi1mv$1bi2@piper.pwgsc.gc.ca>:
++ I have checked enterprise.ic.gc.ca/pub/perl/CPAN/modules/by-module/Net
++ and I 
++ did not find it.

It's part of libnet.

++ Am I thinking correctly that this is a module like CGI.pm and I just need
++ to 
++ download it, install it and learn the syntax for usage?

No, just like CGI.pm, it has a man page.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 537
*************************************

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