[10044] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3637 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 4 16:27:17 1998

Date: Fri, 4 Sep 98 13:00:26 -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           Fri, 4 Sep 1998     Volume: 8 Number: 3637

Today's topics:
        "reading line by line from a file until condition is me lsgs@my-dejanews.com
    Re: #!/usr/bin/perl not working? (Clinton Pierce)
    Re: Algorithm help...math and perl... jhildeb2@my-dejanews.com
    Re: CGI search engines scripts (Jonathan Stowe)
    Re: even or odd (John Stanley)
        exit value lost by system? <steves@wco.com>
    Re: exit value lost by system? <steves@wco.com>
    Re: Flushing data to disk for open files (M.J.T. Guy)
    Re: Frames and CGI.pm: How to send output to two frames (Jonathan Stowe)
    Re: Hats off to Tom Phoenix (Chip Salzenberg)
    Re: help needed -> cgi-answer (Jonathan Stowe)
        Help-about install Perl on NT 4 <mtao@osf1.gmu.edu>
    Re: how does one charge credit cards online <eashton@bbnplanet.com>
    Re: How to DownLoad a file w/o using the browser (I R A Aggie)
    Re: If/Then Statement <rootbeer@teleport.com>
    Re: If/Then Statement (Jonathan Stowe)
    Re: If/Then Statement <aqumsieh@tigre.matrox.com>
    Re: Implemented (Jonathan Stowe)
        info/texi manual for 5.005_02 (binkley)
    Re: MS Word to Text conversion (Kurt Jaeger)
        Net::FTP output/debug question? <thumper@webthumper.com>
        Newbie Question (Ronald Ayoub)
    Re: or vs || with open function (Mark-Jason Dominus)
    Re: or vs || with open function (Andrew M. Langmead)
        Pattern matching specific <bcgrafx@sprynet.com>
    Re: Perl documentation (I R A Aggie)
    Re: Perl documentation (I R A Aggie)
    Re: Precompiled perl for solaris 2.5? (Jonathan Stowe)
    Re: Problems with large numbers (Jonathan Stowe)
    Re: Programmer Needed ASAP (Jonathan Stowe)
    Re: Q: symlink under NT possible? (Jonathan Stowe)
    Re: Removing comments from C files ? (Jonathan Stowe)
        Use Perl to sendmail: open once, send multiple times? (Michael Wang)
        usig a while statement to read from a list and test for lsgs@my-dejanews.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 04 Sep 1998 17:55:10 GMT
From: lsgs@my-dejanews.com
Subject: "reading line by line from a file until condition is met"
Message-Id: <6sp9hu$cgd$1@nnrp1.dejanews.com>

Hi,

I'm a newbie. I'm trying to read a list from a file that has
two variables, "name" and "password" (see this portion of
the script below). When the correct name and password are
entered, the user has access to another area of the site. I can't
get the while statement to work and I'm not sure what I'm
doing wrong. Any help will be appreciated.


if ($query eq "home"){

  open (DATABASE,"new_data/list.db") || die("Cannot open
database: $!");

   while (<DATABASE>) {
          @record = split(/\:/, $_);
      if ($record[0] eq $name and $record[1] eq $passwd) {
      close ("DATABASE");
      &display;
    }



    else {
       close ("DATABASE");

&noway;

     }

  }

}

Laure

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 4 Sep 1998 17:28:00 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
To: Andrew Mulvey <triangle@iinet.net.au>
Subject: Re: #!/usr/bin/perl not working?
Message-Id: <6sp7v0$rk2@eccws1.dearborn.ford.com>

In article <35EFD6EB.4B109D35@iinet.net.au>,
	Andrew Mulvey <triangle@iinet.net.au> writes:
>Hi
>
>*Very* new to Perl person here.
>
>I can easily run perl scripts I have written in Linux (RH5.0) by typing
>"perl exename" at the shell prompt but even if i start the script with
>#!/usr/bin/perl my script won't run simply by entering its name at the
>prompt (and yes i have set the file the script is saved in as executable
>by u, g and o). The perl exe is sitting in /usr/bin btw.
>
>Can anyone enlighten me?
>

Since the script executes properly typing "perl exename", this rounds
it down to one of three possibilities[1]:

#1: At the prompt type:

	./exename

If the script executes, then the current directory is not in your PATH.
Check the manpages for your shell to take care of that.

#2: If an error message comes back like this:

	$ ./exename
	bash: ./exename: No such file or directory

Then you've just received one of UNIX's least helpful error messages.
This is the shell's way of telling you that the #! line in your shell
script (or Perl script) is wrong.  The thing it points to is not an 
interpreter.  Check again.  Then check one more time.  Type "which perl"
to see what the line should read.  Make sure there are no extraneous
characters (spaces, tabs, slashes, control-M's).

#3: If the error message comes back like this:

	$ ./exename
        bash: ./exename: Permission Denied

Then you really haven't make it executable for you.  Re-check the 
permissions.  Again.  Go ahead.  :-)
	

Good luck!


[1] There is a 4th possibility, that is that the OS is guano: wrong 
version of ld, kernel is munged, filesystem is hosed, C Library is 
mismatched, LD_LIBRARY_PATH is kinky, etc...  But we won't go there.
-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



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

Date: Fri, 04 Sep 1998 18:34:57 GMT
From: jhildeb2@my-dejanews.com
Subject: Re: Algorithm help...math and perl...
Message-Id: <6spbsh$fcn$1@nnrp1.dejanews.com>

Excuse me if I have misinterpreted what you're trying to accomplish here but
it looks to me like all you want to do is rename the files.  Instead of
reading in the file and writing it out to a different file it would be easier
to use the move command from File::Copy.  The move command will simply rename
the file if isn't moving to a different physical drive.  That still leaves
you with the problem of creating the new name but everything else is simpler.
 Try something like this:

use File::Copy;
opendir(DIR,"c:\\Temp\\Perl\\thistest\\");
@files = readdir(DIR);
$letter="aaa";
foreach $file (@files) {
    $newfile = $file . $letter;
    move($file, $newfile);
    $letter++;
}

Jim Hildebrand


In article <6semcu$7jh$1@usenet01.srv.cis.pitt.edu>,
  "Tomsic, Paul" <ptomsic@pitt.edu> wrote:
>
> thanks for the prompt reply, but don't think I can do that.
> I've got the following..
>
> ____________________________________
>
> opendir(DIR,"c:\\Temp\\Perl\\thistest\\");
> @files = readdir(DIR);
> foreach $file (@files) {
>  $newfile = $file . $letter;
>  @data = ();
>
>  open(FILE,"c:\\Temp\\Perl\\thistest\\$file");
>
>  while(<FILE>) {
>   push(@data,$_);
>  }
>  open(NEWFILE,">c:\\Temp\\Perl\\thistest\\$newfile");
>  print NEWFILE @data;
>
>  unlink("c:\\Temp\\Perl\\thistest\\$file");
> }
> ____________________________________
>
> but I can't seem to get the assignment to the $letter variable correct.
> any thoughts?
>
> Paul
> tomsicpj@msx.upmc.edu
>
> Larry Rosler wrote in message ...
> >[Posted to comp.lang.perl.misc and a copy mailed.]
> >
> >In article <6sejpk$7a4$1@usenet01.srv.cis.pitt.edu> on Mon, 31 Aug 1998
> >12:41:19 -0400, Tomsic, Paul <ptomsic@pitt.edu> says...
> >> I'm trying to make a program that will take a directory of files (on NT)
> >> and assemble them in order, so I'm thinking about appending a letter on
> to
> >> the end of each file, such that
> >> file1_a, file2_b, file3_c,...,file27_aa, file28_bb, etc.
> >>
> >> That way the directory would be in order.  NT orders such that the files
> >> would be
> >> 1,10,100,2,20,200,3,30,300 which is no good.
> >>
> >> Has anyone done anything like this?
> >> I'm looking at something like the following scenerio....
> >
> >Use something like this:
> >
> >sprintf 'file%.3d', ++$n;
> >
> >to get a suffix that has leading zeros.  `perldoc -f sprintf`.
> >
> >--
> >(Just Another Larry) Rosler
> >Hewlett-Packard Laboratories
> >http://www.hpl.hp.com/personal/Larry_Rosler/
> >lr@hpl.hp.com
>
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 04 Sep 1998 19:32:19 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: CGI search engines scripts
Message-Id: <35f02c74.3896104@news.btinternet.com>

On Fri, 04 Sep 1998 10:34:26 GMT, vivekvp@hotmail.com wrote :

>are there any CGI search engine scripts out there?  i want one that will
>search the majoy search engines form one site - then returnt he output to me.
> is there such an animal - or do i have to pay to get one?
>

I believe that there is a module available from CPAN that will help
you with developing this (I cant remember the name and Mrs Gellyfish
is on the phone right now) - but I get the feeling that you dont want
to be writing something and as this group is generally populated with
people who are interested in writing programs then I guess that you're
out of luck here - you might try searching the web or looking at
www.cgiresources.com or something.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 4 Sep 1998 18:15:37 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: even or odd
Message-Id: <6spao9$mk5$1@news.NERO.NET>

In article <1dessjw.1u5tk3tkrltneN@bay2-87.quincy.ziplink.net>,
Ronald J Kimball <rjk@coos.dartmouth.edu> wrote:
>John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>
>> In article <6seo42$r42$1@nnrp1.dejanews.com>,
>>   <birgitt@my-dejanews.com> wrote:
>> >In article <6sbo6n$be$1@news.smart.net>,
>> >  hymie@lactose.smart.net (hymie!) wrote:
>> >> Every (integer) is an even multiple of 1, because 1 divides evenly into
>> >> them all with no remainder.
>> 
>> Whoops. Definition shift leads to incorrect result.
>
>Like many words in the English language, 'even' has several meanings.

Yes, that is another way of saying what I said.

>> >> 9 is an even multiple of 3, because 3 divides into it evenly.
>> 
>> 9 is an odd multiple of 3. It may be an "exact" multiple of 3, but in
>> this context something either is a multiple of something else or it is
>> not. Talking about "exact" is silly. That's what happens when you talk
>> integers.
>
>3 evenly divides 9.  9 is an even multiple of 3.  

Bzzzzt. Definition shift yeilds incorrect result. 9 is a multiple of
three. There is no "even" to it. When talking about integers, something
either is or is not a multiple of something else. The use of "even" in
"even multiple" implies that the word "even" is adding some
information. Since "multiple" tells you that there is no remainder when
dividing, "even" must refer to something else.

> The result of dividing 9 by 3, however, is an odd number.

That is what makes 9 an odd multiple of 3.

>Consider: if you have three boards that you placed side by side, and all
>three boards were the same length, then you would say that the ends of
>the board were even.  For this definition of 'even', the antonym is
>'uneven', not 'odd'.

9 is not an uneven (in "length of boards" sense)  multiple of 3. 8 is
not an uneven multiple of three.  Since you cannot use the term
"uneven" in this case, you would not use "even" in the same sense. That
leaves the other meaning, and thus the statement "9 is an even multiple
of three" is incorrect.

>> >A non native English speaker would get confused here. I thought an even
>> >number is a number you can divide by 2 without a having a remainder.
>> 
>> It is.
>
>Yes, an even *number* is a number you can divide by 2 without having a
>remainder.  

Just like I said.

>But hymie was referring to even *multiples*, not even numbers.

Yes, and the only numbers that are even multiples of 1 are the even
numbers. All the rest are odd multiples of 1. 3 is 3*1, and 3 is odd. 
5 is 5*1 and 5 is odd. 6 is 6*1, 6 is even, thus 6 is an even multiple
of 1. But 6 = 2*3, 3 is odd, so 6 is an odd multiple of 2.



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

Date: Wed, 02 Sep 1998 12:52:01 -0700
From: Steven Smith <steves@wco.com>
Subject: exit value lost by system?
Message-Id: <35EDA1E1.92B385DC@wco.com>

I have to be doing something foolish here but I don't see what.  I have
a perl
function called by another perl function and $? doesn't contain the
right
value upon return.

Simple scripts to illustrate problem:
====== t.pl:
#!/usr/local/bin/perl
exit(512);
====== t.csh:
#!/bin/csh
exit 1;
======t1.pl:
#!/usr/local/bin/perl
system "t.pl";
print "$?\n";
system "t.csh";
print "$?\n";
========file permissions:
-rwxrwxr-x   1 sjs      sw            20 Sep  2 12:44 t.csh
-rwxrwxr-x   1 sjs      sw            33 Sep  2 12:34 t.pl
-rwxrwxr-x   1 sjs      sw            83 Sep  2 12:34 t1.pl
======== script output:
> t1.pl
0
256

The csh return value is correct, the perl is not.  What gives?  I get
the same
result under both Sun OS and Solaris.  I have perl version 5.004_04.

Thanks
Steve Smith
DSC Communications
Petaluma, CA.



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

Date: Wed, 02 Sep 1998 13:59:33 -0700
From: Steven Smith <steves@wco.com>
Subject: Re: exit value lost by system?
Message-Id: <35EDB1B5.90C79814@wco.com>

Opps -- sorry.  The return value is << 8 which shifts it
to 0. :(

Steven Smith wrote:

> I have to be doing something foolish here but I don't see what.  I have
> a perl
> function called by another perl function and $? doesn't contain the
> right
> value upon return.
>
> Simple scripts to illustrate problem:
> ====== t.pl:
> #!/usr/local/bin/perl
> exit(512);
> ====== t.csh:
> #!/bin/csh
> exit 1;
> ======t1.pl:
> #!/usr/local/bin/perl
> system "t.pl";
> print "$?\n";
> system "t.csh";
> print "$?\n";
> ========file permissions:
> -rwxrwxr-x   1 sjs      sw            20 Sep  2 12:44 t.csh
> -rwxrwxr-x   1 sjs      sw            33 Sep  2 12:34 t.pl
> -rwxrwxr-x   1 sjs      sw            83 Sep  2 12:34 t1.pl
> ======== script output:
> > t1.pl
> 0
> 256
>
> The csh return value is correct, the perl is not.  What gives?  I get
> the same
> result under both Sun OS and Solaris.  I have perl version 5.004_04.
>
> Thanks
> Steve Smith
> DSC Communications
> Petaluma, CA.





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

Date: 4 Sep 1998 18:05:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Flushing data to disk for open files
Message-Id: <6spa59$gm0$1@pegasus.csx.cam.ac.uk>

Larry Rosler <lr@hpl.hp.com> wrote:
>
>I didn't suggest using '$| = 1' because of negative performance 
>implications.  See the beginning of the FAQ you refer to.  The 
>'seek/tell' approach retains the benefits of buffering, but flushes when 
>desired.

There's only performance implications if you leave $| set to 1.
To flush the currently selected output, just do

         $| = 1; $| = 0;

[ On sufficiently ancient Perls, you'll need to do
         $| = 1; print ''; $| = 0;
]

Though from the description of the application, it sounded as though
the performance implications would be negligible.


Mike Guy


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

Date: Fri, 04 Sep 1998 19:32:15 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Frames and CGI.pm: How to send output to two frames?
Message-Id: <35f0283c.2862251@news.btinternet.com>

On 04 Sep 1998 02:53:19 -0500, John Verzani wrote :

>
>
>Here's my problem:
>
>I have a frameset containing 3 frames.  One is a form which in turn
>updates another frame. I would like to then update yet another frame
>without the user having to do anything. I don't think this can be done
>in HTML, so I'm looking for a perl solution. My script is using
>CGI.pm. I thought I could do this with a combination of a fork and a
>redirect command like this:
>

You could of course do this with Javascript (nasty) but that isnt Perl
really is it.  You need to specify the target frame in the header that
your script sends back (of course this isnt Perl specific either you
should check out the HTTP and CGI specifications).  The CGI.pm
documentation however does speak of this in some detail:

WORKING WITH NETSCAPE FRAMES
    It's possible for CGI.pm scripts to write into several browser
    panels and windows using Netscape's frame mechanism. There are
    three techniques for defining new frames programmatically:
<etc>

You should also read the Netscape documentation on frames available
from their developer web site.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 4 Sep 1998 15:51:25 -0400
From: chip@pobox.com (Chip Salzenberg)
Subject: Re: Hats off to Tom Phoenix
Message-Id: <6spgbt$ghg$1@cyprus.atlantic.net>

According to Brad Murray <murrayb@vansel.alcatel.com>:
>chip@pobox.com (Chip Salzenberg) writes:
>> Philanthropy must be performed for its own sake, for moral and
>> ethical reasons.  Otherwise it's just currying or grandstanding.
>
>I guess the point needs to be made a little more bluntly: if people
>consistently shit on your gifts, you will probably start disliking
>people and being wary of giving gifts.

Depends on your motives.

I'm one of Jehovah's Witnesses.  As individuals, we can go _months_
between genuine expressions of interest in our message.  And I've been
verbally abused more times than I can count.  But since we're not in
it for the appreciation, but rather for the best interests of those
involved, we don't get discouraged.

"Hence when you go making gifts of mercy, do not blow a trumpet ahead
of you, just as the hypocrites do in the synagogues and in the
streets, that they may be glorified by men. Truly I say to you, They
are having their reward in full." -- Matt. 6:2

> ... an expectation that people will treat a gift as something they
> wouldn't have had before.  It's just plain impolite to complain to
> the gift giver about the size or colour.

Expecting politeness from a large population is at best naive.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Fri, 04 Sep 1998 19:32:27 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: help needed -> cgi-answer
Message-Id: <35f03622.6214818@news.btinternet.com>

On Fri, 04 Sep 1998 17:38:30 +0200, georgjansen wrote :

>I post my form from  a frameset , and now I want to get the answer in
>another frame.
>Real stupid problem.
> 

There probably arent any stupid questions on Usenet - just stupid
places to post them.

This cannot really be categorized as Perl question, but if you are
using CGI.pm (and perhaps even if you arent) then you should refer to
the documentation for that module.  You should also refer to the
Netscape documentation on frames available from their developer web
site.

Hang on didnt I just type all that stuff five minutes ago?

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Fri, 04 Sep 1998 14:16:45 -0400
From: tao Mengtao <mtao@osf1.gmu.edu>
Subject: Help-about install Perl on NT 4
Message-Id: <35F02E75.8E1F01@osf1.gmu.edu>

 After I install the perl 5 forwin32, Whenever I want to run
the CGI file, it always jump out a frame: Username and passward requird.


Enter username for unknown at XXXXXX.

: : What's the matter?

It's seemed no matter it exists or not, no matter where it is(/cgi,
/cgi-bin
or /http), whenever I want to execute a .cgi or .pl file, it always
jumps out this
frame and, I also don't know what's the username and passward, I mean I
am
the adm of that server, no username and passwd can be used.




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

Date: Fri, 04 Sep 1998 19:08:34 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: how does one charge credit cards online
Message-Id: <35F0385A.BF9C99CF@bbnplanet.com>

http://www.news.com/News/Item/0,4,25906,00.html?st.ne.fd.gif.d

"The level of effort that people are expending on security continues to
be underwhelming," Murphy said. "People still think it's going to happen
to somebody else, not to them. What we found is that people aren't
adequately up to the challenge. Across the board, they are not
consistently taking measures that they need to."

e


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

Date: Fri, 04 Sep 1998 11:08:27 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: How to DownLoad a file w/o using the browser
Message-Id: <fl_aggie-0409981108270001@aggie.coaps.fsu.edu>

+ > Vasant Kumar <vasant@bellatlantic.net> wrote in article
<35EDED90.4487@bellatlantic.net>...

+ > : Can someone refer me to some program, script, or code that will let me
+ > : download a file from the given URL site without using the browser. I do
+ > : have access to Unix and Windows 95 machine, and can use Perl, C, or
+ > : Java.

+ > : http://quote.yahoo.com/d/quotes.csv?s=dell&f=sl1d1t1c1ohgv&e=.csv

+ Jim Babbington wrote:

+ > Try the LWP module. For what your doing, the "simple" get method
should do just the trick.

Its even simpler than that, if you have the LWP module.

>From a unix shell (note the quotes, they're important!):

lwp-rget 'http://quote.yahoo.com/d/quotes.csv?s=dell&f=sl1d1t1c1ohgv&e=.csv'

It downloads a file called 'quotes.bin', which contains:

"DELL",108.3125,"9/4/1998","10:51AM",+0.25,110.4375,111.25,107,7206600

James


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

Date: Fri, 04 Sep 1998 18:51:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: If/Then Statement
Message-Id: <Pine.GSO.4.02A.9809041148180.25401-100000@user2.teleport.com>

On Fri, 4 Sep 1998, Jonathan M. Hartman wrote:

> if (!open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id"))  
> 	{$error = 'Couldn\'t open file log file!';} 
> 
> Why won't the previous statement set the variable, when the file
> doesn't exist?

What file? It depends upon the value of $job_id, of course. If that
contains odd characters, such as a trailing vertical bar or whitespace,
you may be asking for something other than you expected.

If that's not the problem, you may need to cut your code down to make a
small, stand-alone example which demonstrates the bug. If it still shows
up under 5.005, be sure to use the perlbug program to file a bug report.
Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 04 Sep 1998 19:32:28 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: If/Then Statement
Message-Id: <35f03cad.7632982@news.btinternet.com>

On Fri, 4 Sep 1998 11:28:24 -0500, Jonathan M. Hartman wrote :

>if (!open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id"))  
>	{$error = 'Couldn\'t open file log file!';} 
>
>Why won't the previous statement set the variable, when the file doesn't
>exist?
>
But it does , as one would expect (on my system anyhow ;-).

Alternatively you could try something like:

open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id") ||
	($error = 'Couldn\'t open file log file!') ;


/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 04 Sep 1998 14:41:03 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: If/Then Statement
Message-Id: <x3y3ea7afgg.fsf@tigre.matrox.com>


"Jonathan M. Hartman" <cajun@expert.cc.purdue.edu> writes:

> 
> if (!open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id"))  
> 	{$error = 'Couldn\'t open file log file!';} 
> 
> Why won't the previous statement set the variable, when the file doesn't
> exist?
> 

Hmmmm.... let me try that!

aqumsieh@tigre [myPerl] <43>% perl
$error = "Something";
if (!open(MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id"))  
        {$error = 'Couldn\'t open file log file!';} 
print "$error\n";
__END__
Couldn't open file log file!

It works for me .. what version of Perl do you have?

PS. I suggest you use the less visually cluttered version of what you
are trying to do:

open MESSAGE, "/export/home/CAM/cam/rm/logs/$job_id"
    or $error = "Couldn't open log file!";

-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)


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

Date: Fri, 04 Sep 1998 19:32:17 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Implemented
Message-Id: <35f02ae0.3491747@news.btinternet.com>

On Fri, 04 Sep 1998 17:37:14 +0800, Justin Archie wrote :

>Hello,
>
>I have seen some sites that have integrated with PERL script/program
>with a password login. Not just any though it loads something up using
>something similar to htaccess. I have read docs on how to do this, but I
>am not quite sure how to load up the password dialog box and check the
>passwords and username within the script.
>

Getting a browser to request authentication credentials is a matter of
sending the correct headers from your script - this of course could be
done with any language that supports CGI.  You could do worse than
read rfc1945 (regarding the implementation of HTTP) and the CGI FAQ.

However what you can do with the information that the user enters is
server implementation defined and is thus left as an exercise for the
reader.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Fri, 4 Sep 1998 15:23:24 -0400
From: "B. K. Oxley (binkley) at Work" <binkley@eps.inso.com>
Subject: info/texi manual for 5.005_02
Message-Id: <6spepk$8m5$1@ndnws01.ne.highway1.com>
Keywords: info

Does anyone have info files, or texi sources, for 5.005_02?  I can only
find POD, HTML and text files for the documentation, and I'd like to get
at it from Emacs.  (Yes, I know about the slightly out-of-date info
files for 5.004_04).

Thanks!
--binkley





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

Date: 4 Sep 1998 19:30:26 GMT
From: pi@complx.LF.net (Kurt Jaeger)
Subject: Re: MS Word to Text conversion
Message-Id: <6spf4i$ns3$1@news.LF.net>

In article <mshavel-0209981800180001@130.9.16.207>,
Michael Shavel <mshavel@erols.com> wrote:
>> I'm in urgent need of a Perl module/script (heck, any command line
>> application) that can be used to convert larger numbers of MS Word
>> (.doc) documents into plain text (.txt) files. Anyone know of such a
>> critter? Thanks.

>I have just been working on such a script and came looking in this newsgroup 
>for some advice as well.

I have tree different tools for this:

mswordview (generates html, can be post-processed by lynx) for word 8.x
Source: ftp://skynet.csn.ul.ie/pub/linux/utils/mswordview-0.1.0.tar.gz
Best feature: Tells which mess you have in front of you and suggests
those other tools for it 8-)

lhalw (bad name, for word 7.x files)
Source: LAOLA (see CPAN for this), or the posting before.

word2x (similar for word 6.x files)
Source: http://word2x.astra.co.uk/

I love this mess. Helps a big time when asked why we do not use M$ 8-)
We tell them: If its not compatible with itself, why do you think
this stuff really works ?

A PC HW dealer I recently met told me more than 50% of the HW people
are eager to use violence in the direction of Redmond because
of that infamous boot loader they sell from there and those HW people
have to cope with.

Did I mention that I hate M$ ?

-- 
MfG/Best regards, Kurt Jaeger                                  22 years to go !
LF.net GmbH        pi@LF.net
Vor dem Lauch 23   fon +49 711 90074-23 Friedrich-Ebert-Str.1
D-70567 Stuttgart  fax +49 711 7289041  40210 Duesseldorf fon +49 211 179253-11
-- 
MfG/Best regards, Kurt Jaeger                                  22 years to go !
LF.net GmbH        pi@LF.net
Vor dem Lauch 23   fon +49 711 90074-23 Friedrich-Ebert-Str.1
D-70567 Stuttgart  fax +49 711 7289041  40210 Duesseldorf fon +49 211 179253-11


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

Date: Wed, 02 Sep 1998 05:54:59 -0700
From: Web Thumper <thumper@webthumper.com>
Subject: Net::FTP output/debug question?
Message-Id: <35ED4023.2478D457@webthumper.com>

How do see the output from Net::FTP??

What is the array (@messages) where the output ftp messages are stored.
I know that I have seen something (an example) of how to do this in this
news group, but I searched and could not find anything.  I also checked
the FAQ at CPAN and there is no details...besides using the Net::Cmd
module and that didn't really make sense when I read the docs on that
module...at least to me.

All I want to do is see the output from the ftp client...so I can tell
if my perl script is actually doing something.  I have "prints" in
between the $ftp->command statements so I can see that it is going
through the script, but I cannot tell what the actual ftp command output
is.

Thanks in advance.  And please respond through email along with this
news group.

Scott Dinn

--
"Web Thumper"
thumper@webthumper.com
http://www.webthumper.com
San Jose, CA




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

Date: 4 Sep 1998 18:34:47 GMT
From: rayoub@wam.umd.edu (Ronald Ayoub)
Subject: Newbie Question
Message-Id: <6spbs7$for@dailyplanet.wam.umd.edu>

On our company web page there is a form that we have the user fill
out. We want to format that data generated by the form appropriately
and email it to someone who checks it out. I know how to do all this
accept for ensuring data transfer security. My basic question is how
do you encrypt the message being sent by the form to the web server so
that the user of the web page doesn't get a message warning him about
how that data is not encrpted, continue or cancel? Thanks.



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

Date: 4 Sep 1998 15:04:12 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: or vs || with open function
Message-Id: <6spdjc$2u0$1@monet.op.net>

In article <35F00AE8.E644E3C9@cookwood.com>,
Liz Castro  <Liznet@cookwood.com> wrote:
>Throughout the 2nd edition Llama book, Schwartz consistently uses "|| die".
>And in all the scripts I've downloaded and looked over, they also use "||
>die". 
>
>What's the deal?


	open (FH, $file) or die ...;		# GOOD
	open  FH, $file  or die ...;            # GOOD
	open (FH, $file) || die ...;		# GOOD
	open  FH, $file  || die ...;		# OOOOOPS.

This last one was equivalent to

	open FH, ($file || die ...);

which means that it will always die if $file happens to be `0', but
never when $file happens to be '`/etc/passwd'.



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

Date: Fri, 4 Sep 1998 19:40:22 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: or vs || with open function
Message-Id: <EyrynA.K6E@world.std.com>

Liz Castro <Liznet@cookwood.com> writes:

>Throughout the 2nd edition Llama book, Schwartz consistently uses "|| die".
>And in all the scripts I've downloaded and looked over, they also use "||
>die". 

Since the Llama was released while there was still a sizable audience
using perl 4, (the 1st edition was released around the perl 5 beta
releases, so Randal had a good idea of the differeences between the
two.) and since the "or" operator was only available in perl 5, he
probably intentionally chose constructs compatible with both versions
of the language. 

In perl 4, open() was an function that took two arguments. In perl 5,
there are no functions that take two arguments, they can either take
no arguments, one arguments, or a list of arguments. (Although after
it has evaluated the list of arguments it can decide there are too
many of them and compalain.) Also in perl 4, some functions required
parenthesis after the function name, and some did not. In perl 5, they
are always optional (although they can still be used to alter
precedence)

So the construct:

     open(FILE, 'filename') || die "Can't open file: $!\n";

with the parens around the arguments to open() are compatible with
both implementations of the language, while:

     open FILE, 'filename' || die "Can't open file: $!\n";

only works in perl 4. In perl 5, it evaluates "'filename' || die ..."
first and passes the result to open as the second argument.

and obviously 

     open FILE, 'filename' or die "Can't open file: $!\n";

only works in perl 5, because perl 4 chokes on the "or" operator.
-- 
Andrew Langmead


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

Date: Fri, 04 Sep 1998 15:02:43 -0400
From: bc <bcgrafx@sprynet.com>
Subject: Pattern matching specific
Message-Id: <35F03953.A3700B69@sprynet.com>

I have a file that has  the following information for example

One    Two    Three    Four       Five
           xyz                  P019
 2                             C12345

I need to get the information from under the heading Four.
It isn't always the same and neither is the text before the part I need.

The last dilemma is that the field after the 4th column is not always
empty.
Is there a pattern match that specifies the characters literally.
What I need is the 26th through the 31st characters of each line.
I can't seem to find anything about how to match specific parts of a
line without
knowing there content to give pattern by.
Please help
Thanks




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

Date: Fri, 04 Sep 1998 10:58:15 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl documentation
Message-Id: <fl_aggie-0409981058160001@aggie.coaps.fsu.edu>

In article <35f70381.20857333@news.cableol.net>,
david.hawker@removethis.cableol.co.uk wrote:

+ On Sun, 30 Aug 1998 01:10:19 GMT, sowmaster@juicepigs.com (Bob Trieger)
+ felt the need to post:

+ >Who cares if it screws up everyone elses postal service as well as 
+ >yours? You will get less junk mail.
 
+ If this is an attack on corrupting the email address when posting to usenet
+ - it can't take a genius to figure out you need to remove the bit that says
+ "removethis"

Ummm...because some people will send an email response without checking
first?

You're just cost shifting your spam fighting to other people. The same
thing spammers do, ironically.

James


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

Date: Fri, 04 Sep 1998 11:02:37 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl documentation
Message-Id: <fl_aggie-0409981102370001@aggie.coaps.fsu.edu>

In article <35f0fd28.19231453@news.cableol.net>,
david.hawker@removethis.cableol.co.uk wrote:

+ I'm always pleased to receive paper mail. It's different than email - for
+ one thing you don't get "get rich quick by sending us $5" sort of things by
+ post.

That's because the sender pays for the mail to go, and you don't have
to pay to receive.

For another, such schemes would be illegal in most, if not all, countries
in the world.

James - which is why they're usually photocopied and stuck on the ummm...
        windscreen of your car


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

Date: Fri, 04 Sep 1998 19:32:24 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Precompiled perl for solaris 2.5?
Message-Id: <35f0333b.5631240@news.btinternet.com>

On 4 Sep 1998 14:32:02 GMT, Philip Le Riche wrote :

>Can anyone point me to (or send me) a precompiled version of Perl5 for
>Solaris 2.5 please? I don't seem to have a dev system.
>

Better might be to obtain a precompiled gcc development system for
your platform with which you can build Perl - the advantage  of this
is that you can take advantage of binary Perl extensions which you
might need at a later date (and supplement other utilities that you
might want for that matter - just replaced "more" with "less" on two
Solaris machines today because that Solaris "more" was pissing me
off).  I cant remember the URL but there is a freeware link from Sun's
Solaris pages.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Fri, 04 Sep 1998 19:32:25 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Problems with large numbers
Message-Id: <35f0357a.6076242@news.btinternet.com>

On Fri, 04 Sep 1998 09:57:09 -0500, Eric Ladner wrote :

>This works:
>
>$n = rand(2**53);
>print "$n\n";
>
>This doesn't:
>
>$n = rand(2**53);
>printf "%016d\n", $n
>

Does using %e instead of %d help ?

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Fri, 04 Sep 1998 19:32:14 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Programmer Needed ASAP
Message-Id: <35f025eb.2270160@news.btinternet.com>

On Thu, 3 Sep 1998 22:25:44 -0400, Ronald J Kimball wrote :

>Aaron <aaron@pornoinferno.com> wrote:
>
>> and will pay hansomly.
>               ^^^^^^^^
>
>But, you'll have to pay income taxis.
>

Ah the taximeter cabriolet - 

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Fri, 04 Sep 1998 19:32:21 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Q: symlink under NT possible?
Message-Id: <35f02e17.4315292@news.btinternet.com>

On 4 Sep 1998 11:01:03 GMT, Bernhard Ehrminger wrote :

>Hi,
>I would like to know if symlink works under NT?
>IF not: are there other options for creating links
>in an automatic manner under NT (no its not a joke)?
>

Yeah, its called "copy" and thats not a joke either.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Fri, 04 Sep 1998 19:32:22 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Removing comments from C files ?
Message-Id: <35f02f3f.4611063@news.btinternet.com>

On Fri, 04 Sep 1998 12:11:04 GMT, asheikh@my-dejanews.com wrote :

>How do I remove comments from a C file using perl's pattern matching. Please
>note that comments can span multiple lines. Here is some examples:
>

It might behove you to lurk on over to comp.lang.c and observe one of
their regular disputations on the subject of commenting - something
they get almost as excited about there as people here do about, say,
parsing E-Mail addresses (;-) - I would hope that this will suggest
that things are not quite as simple as they might seem.  Of course you
might be dealing with your own code and thus neednt worry about it
that much.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 4 Sep 1998 18:42:57 GMT
From: mwang@tech.cicg.ml.com (Michael Wang)
Subject: Use Perl to sendmail: open once, send multiple times?
Message-Id: <6spcbh$f9u$1@news.ml.com>

How do I use Perl to sendmail but I want to open once, send multiple times?
The following example does not work. Should I directly connect to the 
sendmail port, or do mutilple open/close? Thanks.

  open(SENDMAIL, "|/usr/lib/sendmail -oi -t") 
      print SENDMAIL "From: <me\@me.com>\n";
      print SENDMAIL "To: <$someone\@some.site>\n";
      print SENDMAIL "$some_message\n";
      print SENDMAIL ".\n";
#
      print SENDMAIL "From: <me\@me.com>\n";
      print SENDMAIL "To: <$someoneELSE\@some.site.ELSE>\n";
      print SENDMAIL "$some_message_ELSE\n";
      print SENDMAIL ".\n";
  close(SENDMAIL) or warn "sendmail didn't close nicely";
-- 
unix programs: niftp (non-interactive recursive ftp), hide (hide command args), 
submit (replace nohup), etc from ftp://ftp.mindspring.com/users/mwang/unix-prog
Michael Wang, mwang@ml.com, Merrill Lynch, World Financial Center, 212-449-4414


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

Date: Fri, 04 Sep 1998 18:01:51 GMT
From: lsgs@my-dejanews.com
Subject: usig a while statement to read from a list and test for condition
Message-Id: <6sp9ue$cuo$1@nnrp1.dejanews.com>

Hi,

I'm a newbie at perl. I'm trying to write a program that
checks for names and passwords from a file (this part of the
program shown below). I'm using the "while statement" but
it's not looping through the list or checking the condition.
Can anyone help me?


if ($query eq "home"){

  open (DATABASE,"new_data/list.db") || die("Cannot open
database: $!");

   while (<DATABASE>) {
          @record = split(/\:/, $_);
      if ($record[0] eq $name and $record[1] eq $passwd) {
      close ("DATABASE");
      &display;
    }



    else {
       close ("DATABASE");

&noway;

     }

  }

}

Thanks very much,

Laura

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

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

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