[11908] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5508 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 28 16:07:20 1999

Date: Wed, 28 Apr 99 13:00:19 -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           Wed, 28 Apr 1999     Volume: 8 Number: 5508

Today's topics:
    Re: "learning perl" does not seem to be written well <ortoleva@indiana.edu>
    Re: Confused about s/// example in the Camel book <bdp@mutagenic.org>
        deprecate this kucerar@hhmi.org
        emergent problem - binary file in perl <bwlang@nospam.genome.wi.mit.edu>
    Re: emergent problem - binary file in perl <rick.delaney@home.com>
        Enterprise on Novell w/Perl Scripts <hpman@erols.com>
    Re: Help reading directories and displaying contents (Clinton Pierce)
    Re: Help understanding this script <aqumsieh@matrox.com>
        HELP: Hast sort and strange results markg@activerse.com
    Re: HELP: Hast sort and strange results <rick.delaney@home.com>
        Help: Out of memory during Installation <scott.wachtler@cdc.com>
    Re: How to change the HTTP_REFERER?? <smiles@wfubmc.edu>
    Re: Many hashes with same keys <aqumsieh@matrox.com>
    Re: Many hashes with same keys (Bart Lateur)
        NewBie: using If statment with multiple expressions <dennis@rietvink.demon.nl>
        NewBie: using If statment with multiple expressions <dennis@rietvink.demon.nl>
    Re: NewBie: using If statment with multiple expressions (Sam Holden)
    Re: NewBie: using If statment with multiple expressions (Bart Lateur)
    Re: NewBie: using If statment with multiple expressions <bwlang@nospam.genome.wi.mit.edu>
    Re: PERL & Y2K (Larry Rosler)
        problem <x30407@wrek1.mar.lmco.com>
    Re: Telnet problems sboss@my-dejanews.com
        Uninstalling PerlEx 1.1 <tmcgee@bondmarkets.com>
    Re: What does this error message mean? (Larry Rosler)
    Re: What does this error message mean? <aqumsieh@matrox.com>
    Re: What does this error message mean? <aqumsieh@matrox.com>
    Re: What does this error message mean? (Bart Lateur)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 28 Apr 1999 13:45:46 -0500
From: "P. Ortoleva" <ortoleva@indiana.edu>
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <37275758.90AB961D@indiana.edu>



David Cassell wrote:

>
> >
> > I definitely see that in my life. What the little ORA handbook needs is
> > fifty or so blank pages for user notes. I'm reminded of learning natural
> > languages and the little opaque idioms one must master to insure the waiter
> > brings a mug of beer and not a bowl of Cream of Octopus soup.
>
> Ah yes.  For fun, try to say "I am full" after eating with a European.
> The literal translation is (in several languages) a euphemism for
> "I am pregnant."  Oops!
>

In Russian, it means--literally--"I am fat."  Oops!

Anna Shparberg



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

Date: Wed, 28 Apr 1999 13:42:25 -0600
From: Brian Peisley <bdp@mutagenic.org>
Subject: Re: Confused about s/// example in the Camel book
Message-Id: <372764A1.EFD1D606@mutagenic.org>

Thanks to everyone that answered this. I figured it was something very simple
and obvious. Apparently I forgot to take my vitamins and didn't get the
recommended daily dose of problem solving skills...

Brian Peisley
bdp@mutagenic.org


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

Date: Wed, 28 Apr 1999 19:34:27 GMT
From: kucerar@hhmi.org
Subject: deprecate this
Message-Id: <7g7ns2$n97$1@nnrp1.dejanews.com>

The following conversation has taken place on the Java Web Server List:

--eng.sun.com--
Quick summary:

1. Page Compilation (.jhtml files) is still supported in JWS 2.0.
   Your .jhtml files in JWS 1.1.3 should work under JWS 2.0. If you
   see any problems with page compilation (or any problem for
   that matter) in JWS 2.0, *please* report them (that's the whole
   purpose of this Beta release).

2. Page Compilation (.jhtml) is deprecated in JWS2.0 because it is being
   replaced by JSP (which is an industry standard) to be the preferred way
   of writing web documents for dynamic content. While .jhtml files
   are still supported for backwards compatability, you should start
   using JSP for new development and consider porting your legacy
   applications to JSP.

-isa

-R-
"JSP" is just marketing against "ASP"
with GNU & Linux & Perl & Apache & mod_perl & MySQL
do we really need to put up with any more of this
for-profit nonsense?  Note that I'm not complaining,
simply making the point that there is actually
less serious business risk in using public domain
software...sort of ironic,  if that's the correct usage.
Are you guys writing servers or playing the stock market?
-R-

]X-MS-TNEF-Correlator: <0D399EF04D05D211880900104BC6BC0803B8EF2D@duntx001>
]MIME-Version: 1.0
]Date: Wed, 28 Apr 1999 08:00:51 -0400
]From: "Harshbarger, Aaron H." <Aaron.Harshbarger@qwest.com>
]Subject: Re: pagecompile DEPRECATED in JWS 2.0
]Comments: To: JEEVES-INTEREST LIST <JEEVES-INTEREST@java.sun.com>
]To: JSERV-INTEREST@java.sun.com
]
]What do you mean pagecompile is deprecated?  Will our current .jhtml pages
]need any modification to work under JWS2.0?
]
]-----Original Message-----
]From: Michael Sierchio [mailto:kudzu@dnai.com]
]Sent: Wednesday, April 28, 1999 1:23 AM
]To: JSERV-INTEREST@JAVA.SUN.COM
]Subject: pagecompile DEPRECATED in JWS 2.0
]
]
]I'm curious about why this is the case.  Was it just too hard (with an
]understaffed group) to make a pagecompiler that actually works? ;-)
]
]Or is this part of a design philosophy to put more weight behind JSP?
]

-R-
No,  I'm going to switch to mod_perl using the print<<EOF
technique with embedded $variables (same as <java type=print>
or `variable` techniques).   I don't want to be dependent
on any commercial product with central management control
of decisions of what they're going to stop supporting.  I
can't imagine the linux/apache/perl community doing anything
like this...no revenue problems to drive these decisions...
This puts JWS in the same class as Netscape's crappy servers
(anyone remember HttpApplet?)...perhaps I'm hysterical :)
-R

On 4/28/99 7:27 AM, Kucera, Rich wrote:
>
>who can I sue?  geez, I've got an app dependent on it which I now
>have to re-write I guess...hh well,  been wanting to switch to
>Apache anyhow...perhaps I'll re-write it in mod_perl :)
>

Or you can use ServletExec, which supports Page Compilation (and JSP, and

EOF

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


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

Date: Wed, 28 Apr 1999 14:08:12 -0400
From: "Bradley W. Langhorst" <bwlang@nospam.genome.wi.mit.edu>
Subject: emergent problem - binary file in perl
Message-Id: <37274E8C.1FD6B084@nospam.genome.wi.mit.edu>

im reading a bunch of binary files into memory
using the following construct

$filesize = -s FAMFILE;
for ($i=0;$i<$filesize;$i++) {
    sysread FAMFILE, $tmp1[$i], 1
    print hex($tmp[$i]);
}

it makes no difference whether i use sysread or read
after i do a transformation on the file
i do the write using syswrite

    syswrite FAMFILE, ( sprintf "%lx", ${$newarray}[$i][0] ), 1;

file i am reading
01 00 01 00 02 04 00
in a more interesting area
position 151510
01 2B 30 31 2F 36 0A

what perl is printing on the screen
0000000

what perl is putting out to my file
30 30 30 30 30 30 30

at position 151510
30 30 30 31 30 36 30

this is perl5.004_04 running on digitalunix 4.0D
the people i wrote this for wanted this at
9AM so im getting sweated for it - any hints?

thanks!

brad
bwlang@genome.wi.mit.edu




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

Date: Wed, 28 Apr 1999 18:48:42 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: emergent problem - binary file in perl
Message-Id: <372757A7.B4F37CCD@home.com>

[posted & mailed]

Bradley W. Langhorst wrote:
> 
> im reading a bunch of binary files into memory
> using the following construct
> 
> $filesize = -s FAMFILE;
> for ($i=0;$i<$filesize;$i++) {
>     sysread FAMFILE, $tmp1[$i], 1
>     print hex($tmp[$i]);
> }

One character at a time?  That's not very efficient.  I don't know what
your transformation is but I'm sure you'd be better off reading in
larger chunks, say, the size of a block.

    while($bytes = sysread(FH, $block, $block_size)) {
        # ...
    }
    die "sysread failed: $!" unless defined $bytes;

> 
> it makes no difference whether i use sysread or read
> after i do a transformation on the file
> i do the write using syswrite
> 
>     syswrite FAMFILE, ( sprintf "%lx", ${$newarray}[$i][0] ), 1;
> 
> file i am reading
> 01 00 01 00 02 04 00
> in a more interesting area
> position 151510
> 01 2B 30 31 2F 36 0A
> 
> what perl is printing on the screen
> 0000000

Surely it's printing all kinds of 'Argument not numeric' errors as well.
Aren't you using -w?
 
> what perl is putting out to my file
> 30 30 30 30 30 30 30

Yes, the ascii code for 0, assuming this is a hexdump.  Is that not what
you wanted?  Maybe you want the hexdump to show the same as what's
printed to the screen.  If so you don't want sprintf, but pack. 
Depending on the transformation, you may need neither.

perldoc -f pack

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 28 Apr 1999 15:20:35 -0400
From: "Rich Billingsley" <hpman@erols.com>
Subject: Enterprise on Novell w/Perl Scripts
Message-Id: <7g7n6b$ef2$1@autumn.news.rcn.net>

Enterprise Version: 3
Novell Version 4.11
Perl Version  5

Trying to use a "file upload" script.  Works with standard text files
but not with binary or documents that contain images.

Any clue?

Also the script using is one found on the internet and modified to work
on Novell with Netscape Enterprise.

Thanks in advance.

Rich Billingsley





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

Date: Wed, 28 Apr 1999 13:41:27 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Help reading directories and displaying contents
Message-Id: <372e0f9e.85203806@news.ford.com>

[poster cc'd in e-mail]

On Tue, 27 Apr 1999 20:32:26 -0700, "Max Calvo" <mcalvo@maxcalvo.net>
wrote:
>any help or pointers will be greatly appreciated.

>pendir (DIRLIST,"../wwj/data/sm");

You meant opendir.  And even then this is wrong.  Always, always, always
check the exit status of system calls like "opendir":

	opendir(DIRLIST, "../wwj/data/sm") || die "Cannot opendir: $!";



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

Date: Wed, 28 Apr 1999 14:17:48 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Help understanding this script
Message-Id: <x3yyajcfw37.fsf@tigre.matrox.com>


gustavo9000@my-dejanews.com writes:

> Hello
> 
> I need some help understanding the following lines in a HTML source code.
> 
> <p><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">

And how would posting to comp.lang.perl.misc help you do that?



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

Date: Wed, 28 Apr 1999 19:20:45 GMT
From: markg@activerse.com
Subject: HELP: Hast sort and strange results
Message-Id: <7g7n1v$mb5$1@nnrp1.dejanews.com>

I'm using ActiveStates perl 5.005_02 on an NT box.

I wrote the following simple script to sort a hash
on *not* the keys, but on the values of each hash:

-------------script----------

%symbols = (
	'HD A' => 121.0,
	'HD B' => 100.0,
	'HD C' => 125.0 );

foreach $sym (sort by_ratio %symbols) {
	print "symbol: $sym Ratio: $symbols{$sym}\n";
}

sub by_ratio { $symbols{$b} <=> $symbols{$a}; }

------------script------------------------

This produced the following strange output:

-------------output-------------------

[d:\tools]perl t.pl
symbol: HD C Ratio: 125
symbol: HD A Ratio: 121
symbol: HD B Ratio: 100
symbol: 121 Ratio:
symbol: 100 Ratio:
symbol: 125 Ratio:

------------output---------------------

What are the last three lines output?
If you change the script and sort on the
keys, all is well.

Any ideas are greatly appreciated,

Mark Gaither
Manager of Interactive Services
Activerse, Inc.
markg@activerse.com
whodp://staff.activerse.com/markg

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


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

Date: Wed, 28 Apr 1999 19:51:58 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: HELP: Hast sort and strange results
Message-Id: <3727667C.A82B2468@home.com>

[posted & mailed]

markg@activerse.com wrote:
> 
> foreach $sym (sort by_ratio %symbols) {
>         print "symbol: $sym Ratio: $symbols{$sym}\n";
> }
> 
> sub by_ratio { $symbols{$b} <=> $symbols{$a}; }
> 
> ------------script------------------------
> 
> This produced the following strange output:
> 
> -------------output-------------------
> 
> [d:\tools]perl t.pl
> symbol: HD C Ratio: 125
> symbol: HD A Ratio: 121
> symbol: HD B Ratio: 100
> symbol: 121 Ratio:
> symbol: 100 Ratio:
> symbol: 125 Ratio:

Where are all the uninitialized value warnings?  Aren't you using -w?

> 
> ------------output---------------------
> 
> What are the last three lines output?

They are the 3 elements of the 6 item list you sorted for which 

    exists $symbols{$sym}

is false.

> If you change the script and sort on the
> keys, all is well.

Because if you use keys then you are only providing a 3 item list.  You
don't sort hashes, you sort lists.  To get the output you desire, you
must know what list you want to sort.

    keys %hash

returns a list in list context.

    %hash

returns a list in list context (with twice as many elements).

Try printing them to see the difference.

perldoc perldata

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 28 Apr 1999 12:23:34 -0500
From: scott <scott.wachtler@cdc.com>
Subject: Help: Out of memory during Installation
Message-Id: <37274416.4AA0FFA6@cdc.com>

This is a multi-part message in MIME format.
--------------F046B1610D34FA3C96B3DB0C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

   When installing Perl on my solaris box I get the following error when
it comes to compile the DynaLoader:

Out of memory during ridiculously large request at
 ../../lib/ExtUtils/xsubpp line 198.

    Following the advice of the Install and hint file I added the
-B/usr/ccs/bin/ but that hasn't seemed to help.  Am

I truly running out of memory here, or am I doing something wrong in my
configuration?

  I've attached the complete error output, and myconfig, any help would
be tremendously appreciated.


     Sincerely,
         Scott



--------------F046B1610D34FA3C96B3DB0C
Content-Type: text/plain; charset=us-ascii; name="error"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="error"

`sh  cflags libperl.a globals.o`  globals.c
          CCCMD =  gcc -B/usr/ccs/bin/ -DPERL_CORE -c -I/usr/local/include -O   
`sh  cflags libperl.a perlio.o`  perlio.c
          CCCMD =  gcc -B/usr/ccs/bin/ -DPERL_CORE -c -I/usr/local/include -O   
rm -f libperl.a
ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o regcomp.o dump.o util.o mg.o byterun.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o taint.o deb.o universal.o globals.o perlio.o 
gcc -B/usr/ccs/bin/  -L/usr/local/lib -o miniperl miniperlmain.o libperl.a -lsocket -lnsl -ldl -lm -lc -lcrypt
 ./miniperl -w -Ilib -MExporter -e 0 || make minitest
 ./miniperl configpm tmp
sh mv-if-diff tmp lib/Config.pm
 ./miniperl -Ilib pod/pod2html.PL
Extracting pod2html (with variable substitutions)
 ./miniperl -Ilib pod/pod2latex.PL
Extracting pod2latex (with variable substitutions)
 ./miniperl -Ilib pod/pod2man.PL
Extracting pod2man (with variable substitutions)
 ./miniperl -Ilib pod/pod2text.PL
Extracting pod2text (with variable substitutions)
        AutoSplitting perl library
 ./miniperl -Ilib -e 'use AutoSplit; \
        autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
 ./miniperl minimod.pl > tmp
sh mv-if-diff tmp lib/ExtUtils/Miniperl.pm
File lib/ExtUtils/Miniperl.pm not changed.
`sh  cflags libperl.a perlmain.o`  perlmain.c
          CCCMD =  gcc -B/usr/ccs/bin/ -DPERL_CORE -c -I/usr/local/include -O   

        Making DynaLoader (static)
Makefile out-of-date with respect to ../../lib/Config.pm ../../config.h
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1 || /bin/sh -c true
 ../../miniperl "-I../../lib" "-I../../lib" Makefile.PL "INSTALLDIRS=perl" "LIBPERL_A=libperl.a"
Writing Makefile for DynaLoader
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command.  <==
false
*** Error code 255
make: Fatal error: Command failed for target `Makefile'
Current working directory /tmp/perl5.005_02/ext/DynaLoader
make config failed, continuing anyway...
 ../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib DynaLoader_pm.PL
Skip ../../lib/DynaLoader.pm (unchanged)
cp dl_dlopen.xs DynaLoader.xs
 ../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp -noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs >xstmp.c && mv xstmp.c DynaLoader.c
Out of memory during ridiculously large request at ../../lib/ExtUtils/xsubpp line 198.
Segmentation Fault - core dumped
*** Error code 139
make: Fatal error: Command failed for target `DynaLoader.o'
Current working directory /tmp/perl5.005_02/ext/DynaLoader
*** Error code 1
make: Fatal error: Command failed for target `lib/auto/DynaLoader/DynaLoader.a'


--------------F046B1610D34FA3C96B3DB0C
Content-Type: text/plain; charset=us-ascii; name="myconfig"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="myconfig"

#!/bin/sh

# This script is designed to provide a handy summary of the configuration
# information being used to build perl. This is especially useful if you
# are requesting help from comp.lang.perl.misc on usenet or via mail.

if test -f config.sh; then TOP=.;
elif test -f ../config.sh; then TOP=..;
elif test -f ../../config.sh; then TOP=../..;
elif test -f ../../../config.sh; then TOP=../../..;
elif test -f ../../../../config.sh; then TOP=../../../..;
else
	echo "Can't find the perl config.sh file produced by Configure"; exit 1
fi
 . $TOP/config.sh

# Note that the text lines /^Summary of/ .. /^\s*$/ are copied into Config.pm.

$spitshell <<!GROK!THIS!
Summary of my $package ($baserev patchlevel $PATCHLEVEL subversion $SUBVERSION) configuration:
  Platform:
    osname=$osname, osvers=$osvers, archname=$archname
    uname='$myuname'
    hint=$hint, useposix=$useposix, d_sigaction=$d_sigaction
    usethreads=$usethreads useperlio=$useperlio d_sfio=$d_sfio
  Compiler:
    cc='$cc', optimize='$optimize', gccversion=$gccversion
    cppflags='$cppflags'
    ccflags ='$ccflags'
    stdchar='$stdchar', d_stdstdio=$d_stdstdio, usevfork=$usevfork
    intsize=$intsize, longsize=$longsize, ptrsize=$ptrsize, doublesize=$doublesize
    d_longlong=$d_longlong, longlongsize=$longlongsize, d_longdbl=$d_longdbl, longdblsize=$longdblsize
    alignbytes=$alignbytes, usemymalloc=$usemymalloc, prototype=$prototype
  Linker and Libraries:
    ld='$ld', ldflags ='$ldflags'
    libpth=$libpth
    libs=$libs
    libc=$libc, so=$so, useshrplib=$useshrplib, libperl=$libperl
  Dynamic Linking:
    dlsrc=$dlsrc, dlext=$dlext, d_dlsymun=$d_dlsymun, ccdlflags='$ccdlflags'
    cccdlflags='$cccdlflags', lddlflags='$lddlflags'

!GROK!THIS!

--------------F046B1610D34FA3C96B3DB0C--



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

Date: Tue, 27 Apr 1999 14:41:07 -0400
From: Steve Miles <smiles@wfubmc.edu>
Subject: Re: How to change the HTTP_REFERER??
Message-Id: <372604C3.9DF6A618@wfubmc.edu>

If you use CGI.pm, and make a request using LWP you can trick the referer easy.

Just

$req->referer('http://whatever.com');

It's in Perl in a Nutshell....

Steve
http://www.groundbreak.com

Tim@Globalvision.com wrote:

> Hi There
>
>  Is it possible to trick the CGI script of a foreign host to think that the
> HTTP_REFERER is some thing different than what it really is. I have this
> script that links to another script on a different server, but the foreign
> script checks the referer and thus refuses to compute the data sent from my
> script
>
>       Hope that you can help me
>
>           Tim
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

--
=============================================
Steve Miles (smiles@wfubmc.edu)
----> http://www.groundbreak.com  <----
Wake Forest University School of Medicine
5019 Hanes, Medical Center Blvd.
Winston-Salem, NC 27157
Phone: 336.716.0454     FAX: 336.716.7200
=============================================




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

Date: Wed, 28 Apr 1999 15:01:01 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
To: Tony Labbiento <tonylabb@infonline.net>
Subject: Re: Many hashes with same keys
Message-Id: <x3ywvywfu39.fsf@tigre.matrox.com>


[posted and CCed]

Tony Labbiento <tonylabb@infonline.net> writes:

> Perl hashes, like most hashes, do not allow duplicate keys. Trying to
> create a duplicate key will over write the original. You are allowed to
> have duplicate values.

Of course, your answer has no relation what so ever to the posed question.

> Rob Clark wrote:
> > 
> > Hello,
> > 
> > Can anyone tell me whether Perl does any storage optimisation on many hashes
> > that share the same set of keys?

To answer you question, yes, Perl does such optimization. Starting
from 5.004 (I believe), shared keys are stored only once.

Ahh .. there it is in perlfaq3:

     How can I make my Perl program take less memory?

     When it comes to time-space tradeoffs, Perl nearly always
     prefers to throw memory at a problem.  Scalars in Perl use
     more memory than strings in C, arrays take more that, and
     hashes use even more.  While there's still a lot to be done,
     recent releases have been addressing these issues.  For
     example, as of 5.004, duplicate hash keys are shared amongst
     all hashes using them, so require no reallocation.

	....

HTH,
Ala



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

Date: Wed, 28 Apr 1999 19:17:43 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Many hashes with same keys
Message-Id: <37295db9.1459137@news.skynet.be>

Tony Labbiento wrote:

>Perl hashes, like most hashes, do not allow duplicate keys. Trying to
>create a duplicate key will over write the original. You are allowed to
>have duplicate values.

But different hashes can have the same keys. For example, and array of
identically structured anonymous hashes (Perl's idea of "records").

A current Perl is optimized to store the values of those keys for all
them hashes only once.

	Bart.


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

Date: Wed, 28 Apr 1999 20:44:40 +0200
From: "Dennis" <dennis@rietvink.demon.nl>
Subject: NewBie: using If statment with multiple expressions
Message-Id: <925325072.29614.0.spot.d4ee2fcf@news.demon.nl>

Hi,

Can anyone give me a hint how i can use multiple expressions in a if
statement, like:

if  ( value = 1 OR value = 2 OR value = 3 ) then....

Thanx,

Dennis




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

Date: Wed, 28 Apr 1999 20:52:10 +0200
From: "Dennis" <dennis@rietvink.demon.nl>
Subject: NewBie: using If statment with multiple expressions
Message-Id: <925325524.9245.0.muttley.d4ee2fcf@news.demon.nl>

Hi,

Can anyone give me a hint how i can use multiple expressions in a if
statement, like:

if  ( value = 1 OR value = 2 OR value = 3 ) then....

Thanx,

Dennis





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

Date: 28 Apr 1999 18:47:12 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: NewBie: using If statment with multiple expressions
Message-Id: <slrn7ieltg.gcl.sholden@pgrad.cs.usyd.edu.au>

On Wed, 28 Apr 1999 20:44:40 +0200, Dennis <dennis@rietvink.demon.nl> wrote:
>Hi,
>
>Can anyone give me a hint how i can use multiple expressions in a if
>statement, like:
>
>if  ( value = 1 OR value = 2 OR value = 3 ) then....

You can read the documentation just as well as I can. So why don't
you look it up yourself.

-- 
Sam

Can you sum up plan 9 in layman's terms? It does everything Unix does
only less reliably.
	--Ken Thompson


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

Date: Wed, 28 Apr 1999 19:17:45 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: NewBie: using If statment with multiple expressions
Message-Id: <372b5e9a.1684659@news.skynet.be>

Dennis wrote:

>Can anyone give me a hint how i can use multiple expressions in a if
>statement, like:
>
>if  ( value = 1 OR value = 2 OR value = 3 ) then....

Just like that. Except that this code does assignments, not test
equalities, which will [A] not do what you want, and [B] skip the rest
as soon as one isn't false. The first one in this case.

	Bart.


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

Date: Wed, 28 Apr 1999 15:33:41 -0400
From: "Bradley W. Langhorst" <bwlang@nospam.genome.wi.mit.edu>
Subject: Re: NewBie: using If statment with multiple expressions
Message-Id: <37276295.561BAAB0@nospam.genome.wi.mit.edu>

you got the idea
but you have to use comparison operators
not assignment operators

if ($value ==1 || $string eq 'hello' ) {
    print 'blah\n';
}

Dennis wrote:

> Hi,
>
> Can anyone give me a hint how i can use multiple expressions in a if
> statement, like:
>
> if  ( value = 1 OR value = 2 OR value = 3 ) then....
>
> Thanx,
>
> Dennis



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

Date: Wed, 28 Apr 1999 11:42:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PERL & Y2K
Message-Id: <MPG.1190f66817a73e6a98996a@nntp.hpl.hp.com>

In article <3727489C.594C135B@mail.cor.epa.gov> on Wed, 28 Apr 1999 
10:42:52 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> David Evans wrote:
> > I'm doing some research into PERL and the Year 2000 and was wondering if
> > anyone knows of an existing product that scans PERL script for Y2K
> > compliance?
> 
> Perl is Y2K-compliant.  It's a FAQ.  You can read the FAQ and see the
> relevant info.
> 
> But Perl code is not necessarily Y2K-compliant.  Still, it's so
> easy to check that no one has bothered writing immense wads of
> code to do so.  You just check to see if someone has used one of
> (gmtime, localtime) in the code.  If so, you parse the code
> to find what the name of the $year variable is.  Then you check to see
> if something stupid was done with $year, like appending 19 in front
> of it instead of adding 1900 to it. 

<FLAME BAIT> but please don't bother :-)
Or computing the remainder modulo 100, to accommodate those many 
programs that will (and *should*) print the year as two digits.
</FLAME BAIT>
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 28 Apr 1999 14:50:26 -0400
From: Adam Dittmer <x30407@wrek1.mar.lmco.com>
Subject: problem
Message-Id: <37275872.E3BBB2E@wrek1.mar.lmco.com>

here is my problem.   I have two html database's which i want to updated
via the web.   I have found a way to update one very simply.   One is
organized by a reference number.   the other is organized by part
number.   the reference page was easy i just wrote a simple guest book
program.   with the second page i want to put it in part number order
but i am not sure how to search the html file and pull out what i need
for comparison.   if someone could help me think of a way to get the
info out i would appreciate it.

thx a lot



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

Date: Wed, 28 Apr 1999 17:49:25 GMT
From: sboss@my-dejanews.com
Subject: Re: Telnet problems
Message-Id: <7g7hn3$gtt$1@nnrp1.dejanews.com>

In article <3722335b.0@usenet.fccj.cc.fl.us>,
  "Bill Jones" <bill@fccj.org> wrote:
> In article <7fpr2t$o79$1@nnrp1.dejanews.com>, scott@sboss.net wrote:
>
> >
> > Here is some of the code I have tried....
> >
> >
> > #!/usr/bin/perl -w # $|=1; $login="root"; $pass='password is removed'; use
>
> Are you sure you can login as root over a TTY on your system?
> (Normally you can't by default.)
>
> Refer to the /etc/securetty file to be sure.

Yes, I can login via telnet as root.  It has been setup that way and I can do
it manualy.

Scott

>
> HTH,
> -Sneex-  :]
> ______________________________________________________________________
> Bill Jones  Data Security Specialist  http://www.fccj.org/cgi/mail?dss
>
>          Jacksonville Perl Mongers
>          http://jacksonville.pm.org
>          jax@jacksonville.pm.org
>
>          Running LinuxPPC RedHat 5.0 (Hurricane)
>        __ _                     http://www.linuxppc.org
>       / /(_)_ __  _   ___  __   http://www.apache.org
>      / / | | '_ \| | | \ \/ /   http://www.redhat.com
>     / /__| | | | | |_| |>  <    http://www.perl.com
>     \____/_|_| |_|\__,_/_/\_\   http://www.gimp.org
>
--
Scott Boss
Atlanta Perl Mongers Fearless Leader
website:   http://atlanta.pm.org
community: http://www.dejanews.com/~apm

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


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

Date: Wed, 28 Apr 1999 14:27:16 -0400
From: Tom McGee <tmcgee@bondmarkets.com>
Subject: Uninstalling PerlEx 1.1
Message-Id: <37275304.3C42@bondmarkets.com>

I'm finding my installation of PerlEx 1.1.5 to be far more trouble than
it's worth, and want to get rid of it. Of course, this isn't as simple
as deleting a few files. 

I've tried resetting the file associations in IIS4 back to "perl.exe"
but that's not working. Has anybody done this kind of surgery that can
tell me what steps to follow? Thanks.

Tom McGee
tmcgee@bondmarkets.com


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

Date: Wed, 28 Apr 1999 11:36:26 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: What does this error message mean?
Message-Id: <MPG.1190f5077e305c5b989969@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <x3y676ghhil.fsf@tigre.matrox.com> on Wed, 28 Apr 1999 
11:49:38 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
 ...
> Assuming you use a snippet of code similar to:
> 
> 	while ($line = <FH>) {
> 		bla_bla();
> 	}
> 
> Before version 5.005,

Using version 5.004 (only),

>                      you were required to test whether $line read a
> '0' or not. If it did, then the code above will evalute to false
> (since 0 is false), the while() loop will exit, and no more data will
> be read from FH, even though the end  of file has not been reached.

Actually, the end of file *will* have been reached!  The only way the <> 
(readline) operator can return a string that doesn't end in a newline is 
at the end of file.  Don't forget that "\n" and "0\n" are TRUE.

So, for the nth time, this [fill in an adjective meaning silly;  I have 
also used 'persnickety'*] warning was against not reading the incomplete 
last line of a faulty so-called text file, when the only content of that 
non-line was the single character '0'.  Not very likely in the first 
place, and no big deal to lose the fragment if it is there somehow.

What a heap of bandwidth and time has been wasted over resolving this 
botch.  My apologies to whoever persuaded the Perl developers community 
to accept this change; even great people can make mistakes and can foist 
them onto other smart people.

* per7snick7e7ty adj. 1.a. Overparticular about trivial details; 
fastidious. b. Snobbish; pretentious. 2. Requiring strict attention to 
detail; demanding: a persnickety job.

> To solve this, you need to do:
> 
> 	while (defined($line = <FH>)) {
> 		bla_bla();
> 	}
> 
> In version 5.005 and later, the defined() is implicitly put for you,
> so you don't need to worry about it.

Yes, but as we discovered yesterday, it is still there for:

     if ($line = <FH>) { ... }

I wonder why that is so, and whether it shouldn't be fixed as the 
looping constructs have been fixed. 

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


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

Date: Wed, 28 Apr 1999 14:09:00 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
To: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: What does this error message mean?
Message-Id: <x3y1zh4hb2c.fsf@tigre.matrox.com>


[posted and CCed]

bart.lateur@skynet.be (Bart Lateur) writes:

> >Value of <HANDLE> construct can be "0"; test with defined() at
> >/usr/local/etc/httpd/htdocs/tigron/cgi-bin/glossary.pl line 65535.
> >
> >I can't find an explanation of this message anywhere. What does "line
> >65535" mean? The program file is only 25 lines long. Any help would be
> >appreciated. 
> 
> That's a bit odd. However, 65535 is FFFF in hex, which is -1 as signed
> word. So it's off your script.

I believe this is a bug. I am able to reproduce it:

	% perl -w
	open F, "somefile";
	while ($i = <F>) {}
	__END__
Value of <HANDLE> construct can be "0"; test with defined() at - line 65535.
Name "main::i" used only once: possible typo at - line 2.

Notice that the warning is displayed *after* the __END__ meaning that
it was encountered at run-time. Also, notice the wrong line number
reported. Compare this with:

	% perl -w
	open F, "somefile";
	1 while $i = <F>;
Value of <HANDLE> construct can be "0"; test with defined() at - line 2.
	__END__
Name "main::i" used only once: possible typo at - line 2.

In this case, the warning was displayed *before* the __END__ token, ie
at compile time. AND, the correct line number was reported.

Why is that? any ideas? If not, then I will report it to perlbug and
see.

Ala



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

Date: Wed, 28 Apr 1999 13:53:09 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: What does this error message mean?
Message-Id: <x3y3e1khbsq.fsf@tigre.matrox.com>


paulclinger@my-dejanews.com writes:

> 
> In article <pdyV2.1156$Ev1.746050@NewsRead.Toronto.iSTAR.net>,
>   blairk@istar.ca (Blair Kingsland) wrote:
> > Value of <HANDLE> construct can be "0"; test with defined() at
> 
> It's mean you test, for example, if ($line = <HANDLE>) but this construction
> can return string which contain "0" and if will fail. You need to rewrite it
> as if(defined($line = <HANDLE>)). BTW, perl do it for you in while and for
> loops :)).

If it does, then why the warning? :-)
Actually, it only does for versions 5.005 and later.



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

Date: Wed, 28 Apr 1999 19:17:39 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: What does this error message mean?
Message-Id: <37285c13.1037313@news.skynet.be>

Larry Rosler wrote:

>So, for the nth time, this [fill in an adjective meaning silly;  I have 
>also used 'persnickety'*] warning was against not reading the incomplete 
>last line of a faulty so-called text file, when the only content of that 
>non-line was the single character '0'.  Not very likely in the first 
>place, and no big deal to lose the fragment if it is there somehow.
>
>What a heap of bandwidth and time has been wasted over resolving this 
>botch. 

You forgot something.

If you use "while($_=<>)" to read in several files, and one of them has
"0" as the final line, *the rest of the files will not be read*. Indeed,
the condition for the "while" is was false, yet EOF wasn't reached yet
for this file. So all following files are skipped. That's what all the
fuss is about.

Actually, I would have preferred that "0" as a string would have been
considered as TRUE, so ANY string that isn't the null string (length=0)
is true.

	print chr(48)?'true':'false';
->
prints "false"

	Bart.


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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