[7837] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1462 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 12 14:17:22 1997

Date: Fri, 12 Dec 97 11:00:43 -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           Fri, 12 Dec 1997     Volume: 8 Number: 1462

Today's topics:
     Re: A ^M question. <cdurfee@uswest.com>
     Re: A ^M question. (brian d foy)
     Re: A ^M question. (John Erjavec V)
     Re: A ^M question. <reibert@mystech.com>
     Call a script automatically from a webpage (David Waring)
     Re: Call a script automatically from a webpage (brian d foy)
     Re: Checking if integer/real (M.J.T. Guy)
     Re: date conversation ??? <bteague@aol.net>
     failed to close pipe into sendmail (Ian Kallen)
     Help a newbie out (David Waring)
     Re: Help a newbie out (brian d foy)
     HELP IN "SIMPLE" FOREACH PROBLEM <vidals@etica-entertainment.com>
     Re: HELP IN "SIMPLE" FOREACH PROBLEM (Andrew M. Langmead)
     Help with special caracters <benhaj@eleves.enpc.fr>
     Re: Help with special caracters (brian d foy)
     Re: Help with special caracters (Honza Pazdziora)
     Re: Help with special caracters <reibert@mystech.com>
     HELP: Newbie: Sorting an array just on two fields (David J. Boyd)
     Re: just starting with perl <reibert@mystech.com>
     Re: Learning Perl - How to start <camerond@mail.uca.edu>
     Re: mkdir command <merlyn@stonehenge.com>
     Re: Mysql -> DBI (Jay Flaherty)
     page builder needed <vicster@ix.netcom.com>
     Part of a line rdeleonx@hotmail.com
     Re: Part of a line (Frank)
     Re: Part of a line (brian d foy)
     Re: Part of a line (Honza Pazdziora)
     Re: PERL CGI Parsing <etlndh@etlxdmx.ericsson.se>
     Re: PERL CGI Parsing (brian d foy)
     Re: Perl for windows 95 (David B. White)
     pgp encrypion via perl script rgay@palmetto.net
     Re: Please advise. Fastest way to line-count files <sar@nym.alias.net>
     Re: Question about the =~ operator <bcoleman@mindspring.com>
     Re: RESOURCE KIT ANOMALY... ONE MORE TIME (Nathan V. Patwardhan)
     Re: Socket I/O in Perl5 (M.J.T. Guy)
     Where is perl100.lib(300.lib)? <Aruna=Gorantla%CAE%PCPD=Hou@netgate.compaq.com>
     Re: Write in file from perl body (brian d foy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 12 Dec 1997 09:29:58 -0700
From: Charles Durfee <cdurfee@uswest.com>
To: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: A ^M question.
Message-Id: <34916686.7F68@uswest.com>

Mark S. Reibert wrote:

> If this is not an option, most UNIX's have some kind of utility to 
> convert the CR-LF combination to the simple LF that UNIX uses. If this 
> also is not an option, just strip the CR and leave the LF. Since CR is 
> ASCII character number 13, the following Perl script will do the 
> trick.
> 
> #!/usr/local/bin/perl
> 
> $CR = chr(13);
> while ( <> ) {
>   s/$CR//;
>   print;
> }

The version of Perl (4.036, I think, how does one tell?) here at work
does not have the chr() function.  Is there a way to do the same thing,
maybe with a pack/unpack construction?

I'd be grateful for any help!

-- 
Charles Durfee                    "time waits for no man
Sys Admin -- Denver DCS            but
US West Communications             it just might
Phone (303) 896-2433               wait for me" -- Kim Northrop


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

Date: Fri, 12 Dec 1997 13:02:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: A ^M question.
Message-Id: <comdog-ya02408000R1212971302240001@news.panix.com>

In article <34916686.7F68@uswest.com>, Charles Durfee <cdurfee@uswest.com> wrote:

>Mark S. Reibert wrote:

>> #!/usr/local/bin/perl
>> 
>> $CR = chr(13);
>> while ( <> ) {
>>   s/$CR//;
>>   print;
>> }
>
>The version of Perl (4.036, I think, how does one tell?) here at work

   perl -v

gives the version from the command line.

>does not have the chr() function.  Is there a way to do the same thing,
>maybe with a pack/unpack construction?

you could, of course, use the much more sensible

   s/\cM//g; #control character

or even

   s/\r//g;  #escape sequence

or even

   s/\015//; #octal representation

or even get the newest, Y2K problem free version of perl [1].

ATPS:HTH!

[1] <URL:http://www.perl.com>

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 12 Dec 1997 17:45:54 GMT
From: jev@pconline.com (John Erjavec V)
Subject: Re: A ^M question.
Message-Id: <66rt8i$ss6$1@bell.pconline.com>

Charles Durfee (cdurfee@uswest.com) wrote:
: Mark S. Reibert wrote:
: > #!/usr/local/bin/perl
: > 
: > $CR = chr(13);
: > while ( <> ) {
: >   s/$CR//;
: >   print;
: > }
: 
: The version of Perl (4.036, I think, how does one tell?) here at work
: does not have the chr() function.  Is there a way to do the same thing,
: maybe with a pack/unpack construction?
: 
: I'd be grateful for any help!

Charles-

The first thing tat you will want to do is to get away from version 4.036.
I'm sure that you have heard this before, and I'm sure that you are going
to hear it again, but I would be remiss in my duties not to say it myself.

Now, back to your question.  chr(13) is that ^M character that you were
talking about.  The easiest way to strip it would be to s/^M// .  Note
that the ^Ms used in this message are actually the '^' followed by a 'M'.
You would have to use the actual ^M character, which can be input from vi
by hitting ctrl-v ctrl-m.  I can't recall off the top of my head how to
make them in emacs.  HTH.

-JEV
-- 
John Erjavec V      jev@pconline.com
http://www.pconline.com/~jev/


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

Date: Fri, 12 Dec 1997 10:47:38 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: A ^M question.
Message-Id: <349178BA.D45A1761@mystech.com>

Charles Durfee wrote:

> The version of Perl (4.036, I think, how does one tell?) here at work
> does not have the chr() function.  Is there a way to do the same thing,
> maybe with a pack/unpack construction?
>
> I'd be grateful for any help!
>
> --
> Charles Durfee                    "time waits for no man
> Sys Admin -- Denver DCS            but
> US West Communications             it just might
> Phone (303) 896-2433               wait for me" -- Kim Northrop

Good point - I use strictly Perl 5 and sometimes forget that some things are
not Perl 4 compatible. Try using '\r' (just like C's carriage return)
instead of chr(13). I should think this will exist even in Perl 4. In any
case, it is more portable and so is a better option than chr(13) - always
avoid hard-coding table lookup positions if possible!

BTW, use "perl -v" or print out $] to get the Perl version.

Mark Reibert

-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Fri, 12 Dec 1997 09:53:05 -0800
From: dwaring@nwsr.com (David Waring)
Subject: Call a script automatically from a webpage
Message-Id: <dwaring-1212970953050001@blv-pm110-ip16.halcyon.com>

In article <349150C8.506@builders-connection.com>,
Webmaster@builders-connection.com wrote:

> Call a script automatically from a webpage
> is there a way to call script automatically from a webpage just by
> logging on to that page. Say you go to http://mysite.com/thepage.htm
> and have the script run automatically to redirect you? All the scripts
> I've seen require some kind of action to make them work.

You can execute a script automatically from an html document using an ssi
execution call. It is placed within HTML comment tags. For example

<!--#exec cmd="/pathto/yourscript.pl" -->

Your script can send a response back to the web page but does not have
to.  I have never used this method to redirect but I think that should
work.  I have used this type of call to send text to the webpage (using
print), and also to log the hit without returning anything to the web
page.

You can also send parameters with the call. Here is an example of line
that calls an access log program sending along with it a parameter (a log
file path name so that the script knows which log file to update).

<!--#exec cmd="/pathto/logscript.pl' /pathto/log.txt' " -->

to access this parameter in your perl script use shift eg.

$logfile=shift;

Depending on your server you may have to name the HTML file .shtml, .sht,
or something similar to make this work. In some cases it works fine if it
is named .html.  One other point--I haven't figured everything out about
this but it seems that the permissions on the script, and html file have
some effect on whether this script is executed again if the web page has
been cached (even if your use RELOAD), don't ask me why. I know that 777
works when 755 does not, but I have not tested all possible  permissions,
and it would likely depend on your server.

Hope this works for you.

David Waring


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

Date: Fri, 12 Dec 1997 11:42:03 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Call a script automatically from a webpage
Message-Id: <comdog-ya02408000R1212971142030001@news.panix.com>

In article <349150C8.506@builders-connection.com>, Webmaster@builders-connection.com wrote:

>is there a way to call script automatically from a webpage just by
>logging on to that page. Say you go to http://mysite.com/thepage.htm
>and have the script run automatically to redirect you? All the scripts
>I've seen require some kind of action to make them work.

there are several kludges for this sort of thing, including refresh,
javascript, and so on.  none of them have very much to do with perl 
though.  you might ask in a newsgroup devoted to CGI, for instance.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 12 Dec 1997 18:24:13 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Checking if integer/real
Message-Id: <66rvgd$br$1@lyra.csx.cam.ac.uk>

Bart Lateur <bart.mediamind@tornado.be> wrote:
>
>But puzzles me, is this line:
>
>	local($SIG{'__WARN__'})  = sub { ... };
>
>I know about making whole variables/arrays/hashes local, but only one
>hash element?
>
>It's my understanding that probably the old value is put on some stack,
>temporarily gets a new value in the block, and is restored at the end of
>the block.
>
>Is this correct?

Yes.

>Does this mechanism correctly differentiates between hash elements that
>had undef as value, and elements that weren't in the hash? (See POD,
>"exists" vs. "defined")

Sadly not.   local $hash{$key} = $val;   "autovivifies" $hash{$key} in
the same manner as a simple assignment would.   So after the block
$key is still present, with a value of "undef".


Mike Guy


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

Date: Fri, 12 Dec 1997 11:06:36 -0500
From: Bryan Teague <bteague@aol.net>
Subject: Re: date conversation ???
Message-Id: <3491610C.AD80698F@aol.net>

Sigi wrote:
> 
> Hello
> 
> I was wondering if someone has a fine little script or know of it wich
> takes todays date and says to me what date last friday (sample) had. I
> thank very much for grandiose answers and tips.
> 
> Sigi.


This is very easy to do: 

my($time) = time;
my(%days) = (fri,0,sat,1,sun,2,mon,3,tue,4,wed,5,thu,6); 
my($thisday) = (sun,mon,tue,wed,thu,fri,sat)[(localtime)[6]];
print localtime($time - (86400*$days{$thisday})) . "\n";

That will return today's date if it is friday.  If you would like it to
return last friday's date, you can set $days{'fri'} to 7.  

Output: 

Fri Dec  5 11:05:04 1997 *fri is 7 

Fri Dec 12 11:06:15 1997 *fri is 0

Bryan



-- 
Bryan Teague		bteague@aol.net		Phone: 703-453-4397

If you must choose between two evils, pick the one you've never tried
before.


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

Date: 12 Dec 1997 17:21:56 GMT
From: spidaman@well.com (Ian Kallen)
Subject: failed to close pipe into sendmail
Message-Id: <66rrrl$jfu$1@was.hooked.net>

Here's an odd problem where a forking set of code with children that open
pipes to sendmail are complaining when closing the pipe...
I'm opening sendmail in DeliveryMode=deferred (w/ -t switch) mode within the 
straight-out-of-the-Camel-book fork block below:


FORK: { 
         if ($pid=fork) {
            # the parent
            print PRESEND "$recipient $pid\n" if ($debugging); 
         } elsif (defined $pid) {
            # the child
            local $SIG{PIPE} =
               sub { warn "VERY BAD THINGS: $!\n"; next }; 
            open(QUEUE,"|$mailprog $mopts 2>/tmp/$runid/$qnum")
               or croak "can't do $mailprog $mopts: $!\n"; 
            print QUEUE <<"MQ";  
From: $from 
To: $recipient 
Reply-to: $from 
Precedence: bulk 
Subject: $subject 

$body 
MQ
            close(QUEUE) or die "REALLY BAD STUFF: $! == $?\n"; 
            print POSTSEND "$recipient\n" if ($debugging); 
            exit();  # bye child... 
         } elsif ($!=~/No more process/) {
            sleep 5; 
            redo FORK; 
         } else {
            warn "Wierdo fork problem: $!\n"; 
         } 
} # FORK

Now, where I close the filehandle to sendmail it's dying; I get 
REALLY BAD STUFF: No child processes == -1
logged in my errors log.  However, but sendmail is logging that it's 
doing the right thing... the mail log is showing the messages appearing
"stat=queued" which I interpretted as the close was successful.  I know 
the shell hasn't hit any process limits that Perl's running up against; I 
set the limit extraordinarily high and still get that message.  Is it perl?
Is there something special about opening a pipe in a child process that
I'm not reckoning with?  Is it sendmail complaining unnecessarily (it is
successfully injecting these messages into the queue)?  What's it all mean?

-- 
The next interface will not be another desktop metaphor.... Ian Kallen .... 



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

Date: Fri, 12 Dec 1997 10:17:56 -0800
From: dwaring@nwsr.com (David Waring)
Subject: Help a newbie out
Message-Id: <dwaring-1212971017560001@blv-pm110-ip16.halcyon.com>


 In article <34908399.8C34649@ix.netcom.com>, Eric <ewalti@ix.netcom.com> wrote:
 
 >Hi. I'm good at HTML and i know java too. Now i figure its time to move
 >onto CGI. Right? Anyways, i dont have the slightest idea about CGI. Can
 >someone help me out? help me get started? Any good tutorials out there?
 >Somone please help!!! thanx

You must check our Matts Scripts at http://www.worldwidemart.com/scripts/

He has a bunch of useful scripts but more importantly he has detailed
explanations of how to use them, and the scripts themselves are very well
documented.  I can not overstate how useful his scripts have been to me.
(I was in your position a year ago)  He also has a book on CGI scripting
in Perl.  I have not read it but considering how well he explains things
at the web site I bet it is very worthwhile (it is adverised on his site).

Of course if you are going to be scripting in perl the nutshell books
"Learning Perl, and Programming Perl" (the llama and the camel books) are
must haves.

Finally I would add that I was annoyed by the response to your question (below)
I don't mean to flame, but this is the kind of useless response that I
often see.  He suggests you check out the FAQ but assumes that you know
how to find it (I do not). Second he suggests that you search the web --
WHAT AN IDEA who would have ever thought of that.  From my point of view
posting a question like yours in a forum on Perl is a very reasonable
thing to do. After all anyone can start to search the web for resourses
but why not find out if someone has already done that and found something
useful. He seems to be telling you to go somewhere else and not bother
him.  Perhaps I am overstating his sentiments but that is how I took it -
smiley or not.  If he doesn't want to be bothered by newbies he can ignore
them.

Good Luck

David Waring
---------------

In article <comdog-ya02408000R1212970157380001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:
 
> perhaps you could start with the CGI Meta FAQ.
> 
> or yahoo.
> 
> or some other search engine.
> 
> or a CGI newsgroup.
> 
> good luck :)
> 
> -- 
> brian d foy                                  <comdog@computerdog.com>
> NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 12 Dec 1997 13:46:07 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help a newbie out
Message-Id: <comdog-ya02408000R1212971346070001@news.panix.com>

In article <dwaring-1212971017560001@blv-pm110-ip16.halcyon.com>, dwaring@nwsr.com (David Waring) wrote:

>Finally I would add that I was annoyed by the response to your question (below)
>I don't mean to flame, but this is the kind of useless response that I
>often see.  He suggests you check out the FAQ but assumes that you know
>how to find it (I do not).

perhaps you stopped reading too early.  the attribution fo the CGI
Meta FAQ is in the signature.  i used to post every attribution in
every post, but i found it much more efficient to put them all in
one place.

i'm annoyed that your annoyed.  please be more careful in the future.

>In article <comdog-ya02408000R1212970157380001@news.panix.com>,
>comdog@computerdog.com (brian d foy) wrote:
> 
>> perhaps you could start with the CGI Meta FAQ.
>> 
>> or yahoo.
>> 
>> or some other search engine.
>> 
>> or a CGI newsgroup.
>> 
>> good luck :)
>> 
>> -- 
>> brian d foy                                  <comdog@computerdog.com>
>> NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
>> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 12 Dec 1997 08:49:03 -0800
From: Gil Vidals <vidals@etica-entertainment.com>
Subject: HELP IN "SIMPLE" FOREACH PROBLEM
Message-Id: <34916AFF.C6F51699@etica-entertainment.com>

The following few lines of code has me stumped. I'm new at PERL and
can't figure out why the foreach listed below read twice through the
hash???? It seems as though it is reading past the eof?   The errors
generated are at the bottom of this message.

Thanks,
Gil

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

use GDBM_File;           #GNU dbm is what we use to store html
use Fcntl;                      #used for O_CREAT and other O_values

$db         = "/tmp/dbtest22";

tie(%HTML,"GDBM_File",$db,O_RDWR|O_CREAT, 0666) or
      die "Can't open $db for appending $!";

   $HTML{"joe"} = "mama";

   $x = 1;
   while ( ($key, $value) = each (%HTML) ) {
      print "$key has value of $value; x is $x\n";
      $x++
   }

   $y = 1;
   foreach $key (%HTML) {
     print "$key HAS A VALUE of $HTML{$key} and y is $y\n";
     $y++;
   }

untie %HTML;

-------------------------------- output
------------------------------------------------
joe has a value of mama; x is 1
joe HAS A VALUE of mama and y is 1
Use of uninitialized value at ./db_write line 30.
mama HAS A VALUE of    and y is  2



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

Date: Fri, 12 Dec 1997 18:24:11 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: HELP IN "SIMPLE" FOREACH PROBLEM
Message-Id: <EL39sB.n1t@world.std.com>

Gil Vidals <vidals@etica-entertainment.com> writes:
>   $y = 1;
>   foreach $key (%HTML) {
>     print "$key HAS A VALUE of $HTML{$key} and y is $y\n";
>     $y++;
>   }

When you use a hash in a list context, it returns each key and value
successively. So:

    foreach $key (%HTML)

with your data set is the same as saying:

    foreach $key ('joe', 'mama')

I think you want to use the "keys" function to retrieve just the keys
from the hash.

    foreach $key (keys %HTML)
-- 
Andrew Langmead


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

Date: Fri, 12 Dec 1997 17:53:44 +0100
From: Adel BEN HAJ YEDDER <benhaj@eleves.enpc.fr>
Subject: Help with special caracters
Message-Id: <34916C18.2969@eleves.enpc.fr>

Hello,

   I'am starting with perl, I have a question 
about special caracters.
   I'am using a perl program to get informations
from a form in web page. In the form people can enter 
special caracters (for example ~ when entering an URL
adress). How can I do to get all the caracters
(inculding the ~ for example) ?

Thanks in advance.

Adel BEN HAJ YEDDER
benhaj@eleves.enpc.fr


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

Date: Fri, 12 Dec 1997 13:13:26 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help with special caracters
Message-Id: <comdog-ya02408000R1212971313260001@news.panix.com>

In article <34916C18.2969@eleves.enpc.fr>, Adel BEN HAJ YEDDER <benhaj@eleves.enpc.fr> wrote:

>   I'am using a perl program to get informations
>from a form in web page. In the form people can enter 
>special caracters (for example ~ when entering an URL
>adress). How can I do to get all the caracters
>(inculding the ~ for example) ?

the CGI module will do all of the work for you.  it's documentation
is referenced in the CGI Meta FAQ.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 12 Dec 1997 18:18:26 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Help with special caracters
Message-Id: <adelton.881950706@aisa.fi.muni.cz>

Adel BEN HAJ YEDDER <benhaj@eleves.enpc.fr> writes:

> Hello,
> 
>    I'am starting with perl, I have a question 
> about special caracters.
>    I'am using a perl program to get informations
> from a form in web page. In the form people can enter 
> special caracters (for example ~ when entering an URL
> adress). How can I do to get all the caracters
> (inculding the ~ for example) ?

You use CGI module that will do the work for you. In this case, check
the man page for methods param.

You can get CGI module on any good CPAN store.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 12 Dec 1997 11:10:51 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: Help with special caracters
Message-Id: <34917E2A.55BA94BD@mystech.com>

Adel BEN HAJ YEDDER wrote:

> Hello,
>
>    I'am starting with perl, I have a question
> about special caracters.
>    I'am using a perl program to get informations
> from a form in web page. In the form people can enter
> special caracters (for example ~ when entering an URL
> adress). How can I do to get all the caracters
> (inculding the ~ for example) ?
>
> Thanks in advance.
>
> Adel BEN HAJ YEDDER
> benhaj@eleves.enpc.fr

Web forms encode special characters as a hex number (preceded by a '%') to
avoid any confusion. I use the following Perl fragment to read all my form
data (assuming you are using the "post" method in your form):

read( STDIN, $inputBuf, $ENV{'CONTENT_LENGTH'} );
@varPairs = split( /&/, $inputBuf );
foreach $pair ( @varPairs ) {
  ( $name, $value ) = split( /=/, $pair );
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $form{ $name } = $value;
}

At this point, the 'form' hash contains all the form data. The keys are the
form fields and the values are the data entered into that field on the web
page.

Mark Reibert

-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Fri, 12 Dec 1997 17:49:34 GMT
From: djboyd@nospam.sam.on-net.net (David J. Boyd)
Subject: HELP: Newbie: Sorting an array just on two fields
Message-Id: <3491792c.15371660@news.on-net.net>

I have an array in which each record contains 10 fields.  The first two fields
are data and time.  I would like to sort the array on these two fields.  The
sort ordr would be from the oldest date, earliest time to current date and time.
Now I went to the FAQ, but, due to a lack of full understanding of perl I did
not fully understand what was happening.  So, could some one help me out on
this.
 ...
TIA

To response remove nospam  djboyd@sam.on-net.net

To reply remove nospam from the address: djboyd@sam.on-net.net


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

Date: Fri, 12 Dec 1997 10:56:08 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: just starting with perl
Message-Id: <34917AB8.35AAFED0@mystech.com>

Creede Lambard wrote:

> 3. Associating .pl files with Perl in the file types box under "My Computer"
> has no effect on the command line. It means that if you have a .pl file,
> say, on your desktop or in Explorer and double-click its icon, the file
> opens up with Perl. This also means that (for instance) if you set up the
> script properly, you can drag and drop another file's icon on top of the
> script's icon to have the script operate on the file you dropped. But that's
> another subject for another day.
>

Hmmm, are you sure about this? Under NT file associations work from the command
line. But I avoid Windows 4 (oh, I'm sorry, Windows 95) at all cost so maybe the
behavior is different.

Mark Reibert

-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Fri, 12 Dec 1997 11:45:05 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: Allie <allie@icct.net>
Subject: Re: Learning Perl - How to start
Message-Id: <34917821.5D1829CA@mail.uca.edu>

Allie wrote:
> 
> Jeremy D. Zawodny wrote:
> 
[snip]
>
> > Pick yourself up a copy of "Learning Perl on Win32 Systems" and
> > start from there.
> 
> Does anyone have any more info on this book? I don't have
> programming experience, but I'm eager to start learning Perl. Does
> this book start with the very basic basics? Can anyone reccommend a
> book that does - I'm going to check out the llama and camel, but
> from previous posts it doesn't seem like these really start at basic
> basics. I'll be installing Perl on my computer, running Win95.  Any
> suggestions via email and/or posted appreciated. Thanks, allie

Yes, it is an excellent book, basically the Llama book which has been
adapted for Win32 (so I've been told, I do not have the Llama book,
myself). My only problem with it is that with my eyesight, the curly
braces {} look like parentheses () without my glasses, and I'm too lazy
to put them on unless it's absolutely necessary. (Or, mabye I just don't
want to admit that I'm getting older, and so are my eyes.) If you can do
anything in Win95 beyond double-clicking on Word and playing Hover (and
you must, because you've gotten here), the learning curve shouldn't be
too steep.

Since you "don't have programming experience," I would suggest that in
order to install perl on a Win95 box, however, you either go straight to
the Activestate port (http://www.activestate.com) and download the
newest zip file from there, or (if you want the "standard distribution"
port) skip the instructions in the book dealing with C compilers, etc.,
and go to http://www.perl.org/CPAN/authors/Gurusamy_Sarathy and download
the newest version of his port (5.00402-bindist-04, as of today); it is
also a self-extracting zip file (or tar.gz, which can also be opened
with Winzip or a similar decompressor). Darn, that was a long sentence.
I use GS's port, it works very well, but many like the Activestate port
just as well. To finish installation (i.e., make it work), go to
http://hjs.geol.uib.no/Perl/index6.html-ssi and follow Hans' directions.

Have fun.

Cameron Dorey
camerond@mail.uca.edu


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

Date: 12 Dec 1997 09:33:32 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Russ Allbery <rra@stanford.edu>
Subject: Re: mkdir command
Message-Id: <8czpm65xnm.fsf@gadget.cscaper.com>

>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes:

Russ> [...]  Modes for umask and mkdir
Russ> have to be in octal [...]

No.  They don't.  Perl doesn't care if you say:

	mkdir "foo", 0777;

or
	mkdir "foo", 511;

or

	mkdir "foo", 7*64 + 7*8 + 7;

These all do *exactly* the same!

It just needs a value.  It's easiest for *humans* to think of the
Unix permission field in octal because the 3-bit groupings for user,
group, and other work out nicely then.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 262 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 12 Dec 1997 16:44:39 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: Mysql -> DBI
Message-Id: <66rpln$83s$1@gaia.ns.utk.edu>

Ian Baker (ian@sonic.net) wrote:
: Ian Baker (ian@sonic.net) wrote:
: [snip]
: : that API from the beginning) but I have a problem.  I'm making use of the
: : insert_id method in Mysql.pm, and can't find a DBI counterpart.  Am I
: : overlooking someting, or is nothing like that implemented?
: 
: This morning, I received a response from Matthew Reimer.  Apparently, it's
: 
: $id = $dbh->func("_InsertID");
: 

Actually, all you need to do is use the statement handle method:
$id = $sth->{insertid};

Jay 
--
**********************************************************************  
Jay Flaherty                                               fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************



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

Date: 12 Dec 1997 17:26:27 GMT
From: "vic" <vicster@ix.netcom.com>
Subject: page builder needed
Message-Id: <01bd0731$391c7480$229ab8cd@#vicster>

I would like to have a script that would build web pages. 
It would:
 take a choice from a form when the user hits a "preview" button, their web
page preview appears. Then if anything is left blank it will disregard.
When submitted, it will produce a web page. On the web page it would also
have: "back", "submit", and "preview" buttons. In addition, the original
form will also be present so that they can APPEND by filling out info
again, or leaving areas blank and previewing again. If not satisfied they
can go back, change the form, or go forward and submit it. No access needs
to be given as we upload the pages ourselves. Just submit it to us as mail
for now. It ultimatly would go to our virtual server to be posted as part
of the customer's "Sales Web Package". The company does not want a standard
template and would like this as an alternative where one customer can put
things in different order than another customer.  We will give pulldown
menus of choices of backgrounds and colors, etc. if they choose the stuff,
preview and don't like it they go back, change it, preview again. Once they
like the page they can add to the bottom of the page, separated by a line
or something by filling out a similar form and previewing again, thus
progressing down the page... No tables or anything like that, so each
section is 100% width and stacked right below the previous preview.
Font size choice would be nice. 

Can't find it...willing to pay for it or write it...what'll it cost me?

Vic Dossey
vicster@ix.netcom.com


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

Date: Fri, 12 Dec 1997 11:02:10 -0600
From: rdeleonx@hotmail.com
Subject: Part of a line
Message-Id: <881945134.743374857@dejanews.com>

Hi. I was wondering, how do you read a part of a line in a text file?  For
example, I need to read a line like this:

<br>Copia:<br>Archivo: EXPAC1-USR<br>Guia: AMENA <br>Version: 03<br>

What I need to do is read everything between, and including, "Archivo:"
and the next "<br>" and store it in a scalar.

Any help would be really appreciated.

- Rodrigo

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 12 Dec 1997 17:30:39 GMT
From: FHeasley@chemistry.com (Frank)
Subject: Re: Part of a line
Message-Id: <34917420.3729799@news.halcyon.com>

On Fri, 12 Dec 1997 11:02:10 -0600, rdeleonx@hotmail.com wrote:

>Hi. I was wondering, how do you read a part of a line in a text file?  For
>example, I need to read a line like this:
>
><br>Copia:<br>Archivo: EXPAC1-USR<br>Guia: AMENA <br>Version: 03<br>
>
>What I need to do is read everything between, and including, "Archivo:"
>and the next "<br>" and store it in a scalar.

$everything = '<br>Copia:<br>Archivo: EXPAC1-USR<br>Guia: AMENA
<br>Version: 03<br>';

$everything =~ /Archivo(.*)<br>/;
$stuff = $1;

Frank


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

Date: Fri, 12 Dec 1997 13:10:19 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Part of a line
Message-Id: <comdog-ya02408000R1212971310190001@news.panix.com>

In article <881945134.743374857@dejanews.com>, rdeleonx@hotmail.com wrote:

><br>Copia:<br>Archivo: EXPAC1-USR<br>Guia: AMENA <br>Version: 03<br>
>
>What I need to do is read everything between, and including, "Archivo:"
>and the next "<br>" and store it in a scalar.

how about

   $line =~ m/Archivo:(.*?)<br>/;

   $data = $1;

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 12 Dec 1997 18:13:18 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Part of a line
Message-Id: <adelton.881950398@aisa.fi.muni.cz>

rdeleonx@hotmail.com writes:

> Hi. I was wondering, how do you read a part of a line in a text file?  For
> example, I need to read a line like this:
> 
> <br>Copia:<br>Archivo: EXPAC1-USR<br>Guia: AMENA <br>Version: 03<br>
> 
> What I need to do is read everything between, and including, "Archivo:"
> and the next "<br>" and store it in a scalar.

You use regular expressions for that (manpage perlre), in this case

($string) = /(Archivo:.*?<br>)/i;

Hope this helps,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 12 Dec 1997 16:32:30 +0000
From: Nick Djurovich <etlndh@etlxdmx.ericsson.se>
Subject: Re: PERL CGI Parsing
Message-Id: <3491671D.B8348A63@etlxdmx.ericsson.se>

Ruben Safir wrote:

> Hello
>
> Perhaps someone can help me with a CGI written in perl that I am
> working on.
>
> The script is taking data from a form which is user edited.  It
> is then
> parsed or decoded, then looked up on a database file called
> ussaf.txt.
> When a matching key is found, it is the entire database is copied
> record by record into a new file, with the changed information.
>   Then the newfile is renamed the old file.
>
> I seem to be having trouble with the two opened files.
> I am not being permited to open one file for reading

A common problem is that a CGI script being run by the webserver
normally has the USERID of 'nobody'. Or if not this, some other
userid that isn't the same group as the user (you). What this means
basically is that the permissions on the directory that you wish
to read and write from, have to have WORLD or OTHER access. I
suspect currently the CGI script hasn't permission to write to the
directory.
Do a man on chmod to get more info. Go to the directory where
you want to read/write to and type :

chmod o+rw .

This gives (r)EAD and (w)RITE access to the (o)THER
users ... which is basically any other id.


Hmmm ... why does it think DATAOUT is a subroutine. I thinkyou have a
syntax problem here. Are you sure you have opened
the FILEHANDLE correctly ? eg open( DATAOUT, "> filename" );Perhaps
because it couldn't open the file , this causes DATAOUT
to be undefined as a filehandle and so it thinks it's a subroutine.
Ideally, you should check the result of the open command, check,
and flag and error if there's a problem. Never assume anything ..
is a good motto.

/Nick

> Name:    Nicholas Djurovich
> E-Mail:  etlndh@etlxdmx.ericsson.se
> Phone:   (0)1444 23 4179
>
> Product Development Manager, Business Comms
> Ericsson Telecommunications Ltd.
> Burgess Hill, England
>
> Opinions : All or none of the opinions not expressed here
>            are not necessarily those of my own or of
>            anybody else that I don't know or haven't not
>            yet met.
>
> Disclaimer : I disclaim everything, I didn't do it, nobody
>              saw me, you can't prove anything.





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

Date: Fri, 12 Dec 1997 12:55:14 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: PERL CGI Parsing
Message-Id: <comdog-ya02408000R1212971255140001@news.panix.com>

In article <3491671D.B8348A63@etlxdmx.ericsson.se>, Nick Djurovich <etlndh@etlxdmx.ericsson.se> wrote:

>Ruben Safir wrote:

>> I seem to be having trouble with the two opened files.
>> I am not being permited to open one file for reading

>Do a man on chmod to get more info. Go to the directory where
>you want to read/write to and type :
>
>chmod o+rw .
>
>This gives (r)EAD and (w)RITE access to the (o)THER
>users ... which is basically any other id.

after you are through seriously considering whether you want absolutely
anyone to be able to create, edit, or delete your files, you
might want to go down the hall to the CGI newsgroup where this sort
of thing is on charter. :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
there are much better solutions to this problem


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

Date: 12 Dec 1997 17:00:49 GMT
From: dbwhite@btv.vnet.ibm.com (David B. White)
Subject: Re: Perl for windows 95
Message-Id: <66rqk1$eke$1@mdnews.btv.ibm.com>

In article <348FA295.37CA0091@fuse.net>,
        Acid Bastard <acid@fuse.net> writes:
> This is what it does the program box comes up and I type in my commands
> but nothing happens.

perl does the same thing on AIX until it sees a "Ctrl-D", which tells
it that you've finished entering your program and that now it is time
to get processing.  I don't know if the Win95 keycode is the same, but
it's worth a try....

--
David B. White


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

Date: Fri, 12 Dec 1997 18:34:26 GMT
From: rgay@palmetto.net
Subject: pgp encrypion via perl script
Message-Id: <34917ff8.17495498@news.scescape.net>

Any ideas on  this one...
The following code works fine via command line, however when  executed
via a user's browser will produce a server error.
The server error simply contains the same info that is normally
presented on the screen when script is ran via command line
(information something like a splash screen on a GUI program).

Any help greatly appreciated as I already have 50+ hrs invested in
this problem with no solution as of yet.

======CUT HERE========

print MAIL "blah blah blah stuff in also in mail message";

# encrypt sensitive data and place it in mail message

open (AFILE, "/var/www/secure/temp/data");
print AFILE "sensitive stuff to be encrypted\n";
close (AFILE);

open (PGP, "|$pgpprog -fea \"$pgpuserid\"
<\"/var/www/secure/temp/data\" >\"/var/www/secure/temp/data.asc\"");
close(PGP);
system("cat /dev/null > /var/www/secure/temp/data");

open (ENCRYPTED, "/var/www/secure/temp/data.asc");
@data = <ENCRYPTED>;

print MAIL "@data";
system("cat /dev/null > /var/www/secure/temp/data.asc");

# resume with rest of mail message

print MAIL "blah blah blah stuff in also in mail message";

======CUT HERE========

Roger Gay
rgay@palmetto.net


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

Date: 12 Dec 1997 16:31:15 -0000
From: Scott A.Renner <sar@nym.alias.net>
Subject: Re: Please advise. Fastest way to line-count files
Message-Id: <19971212163115.13449.qmail@nym.alias.net>

>>>>> At 15:46 12/11, Tom Christiansen <tchrist@mox.perl.com> said:
> 
> In comp.lang.perl.misc, steve.tolkin@fmr.com writes:
> :This is great! But if the file does not end in a newline, perl reports
> :one more line than wc -l.  Adding a chomp and a test would fix that.
> 
> You realize, I hope, that that's not a proper text file!  Text files
> contain 0 or more newline-terminated records.  

Now hold on there, pardner!  Aren't you the same Tom Christiansen who just
told me (in <66keo3$qgs$1@csnews.cs.colorado.edu>) that

> Binary files are exactly the same as "text" files.  If not, your
> operating system has a design flaw, and you should upgrade to something
> more robust and modern. :-)

Just kidding, of course :-)

-- 
Scott A. Renner <sar@nym.alias.net>         | If you cannot answer a man's
My organization doesn't want their name     | argument, do not panic.
on my articles, disclaimer or no.  The      | You can always call him names.
mail alias is to hide them, not me.         |                -- Oscar Wilde


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

Date: Fri, 12 Dec 97 13:29:50 +0400
From: "Ben Coleman" <bcoleman@mindspring.com>
Subject: Re: Question about the =~ operator
Message-Id: <osjndigerbcwrae.pminews@user-38lcp47.dialup.mindspring.com>

On 6 Dec 1997 01:37:45 GMT, John Stanley wrote:

>Do the people who own the domain
>za.com know you are creating addresses within their domain for them?

Given that za.com appears to belong to a domain speculator, do we
really care?

Ben
-- 
Ben Coleman NJ8J                     | The attempt to legislatively
Internet: bcoleman@mindspring.com    | micromanage equality results, at
http://bcoleman.home.mindspring.com/ | best, in equal misery for all.





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

Date: 12 Dec 1997 16:07:12 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: RESOURCE KIT ANOMALY... ONE MORE TIME
Message-Id: <66rnfg$im6@fridge.shore.net>

Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh (bsa@void.apk.net) wrote:

: If I had to take a wild guess, I'd suspect case-mapping:  gzip sees ".z" (as
: opposed to ".Z") and tries to treat it as a System III/V "pack" file (Huffman
: code, not LZW or LZ77).

The problem doesn't exist (anymore) with the CPAN.pm that's bundled
with 5.004_04.

--
Nathan V. Patwardhan
please don't send spam to pres@whitehouse.gov


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

Date: 12 Dec 1997 18:30:50 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Socket I/O in Perl5
Message-Id: <66rvsq$ig$1@lyra.csx.cam.ac.uk>

Jim Bowlin  <bowlin@sirius.com> wrote:
>
>$SIG{ALRM} = sub { die "timeout!"};
>alarm(10);
>eval {
>
>   # put your code in here
>   alarm(0);
>}
>
>$@ and $@ =~/^timeout/ and do {
>
>    # process timeout errors here
>};

That'll ignore any die other than a timeout.  Make that something like

 if ($@) {
      die $@ unless $@ =~/^timeout/;

     # process timeout errors here
 };


Mike Guy


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

Date: Fri, 12 Dec 1997 15:53:23 GMT
From: "Aruna Gorantla" <Aruna=Gorantla%CAE%PCPD=Hou@netgate.compaq.com>
Subject: Where is perl100.lib(300.lib)?
Message-Id: <01bd0716$295938f0$679f12ac@agorantla>

Hi,
I need to build perl extensions for C. I have all the perl 100 series
executables and the dll's but I need the perl100.lib to link. Where
can I find this?
I also have the Pw32s* series. I can build them but it doesn't have
the xsubpp compiler. Do I need it?

Thanks.
Aruna.


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

Date: Fri, 12 Dec 1997 11:43:58 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Write in file from perl body
Message-Id: <comdog-ya02408000R1212971143580001@news.panix.com>

In article <66r0b5$obn$1@hq.mark-itt.ru>, "Ivan Klabukov" <postmaster@ivan.udm.ru> wrote:

>Can anyone tell me how can I write in file from perl body if I call my
>script from html document.

open() and print() get the job done.  same as printing to a file in
scripts not called from html documents.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

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

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