[7162] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 787 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 28 15:18:46 1997

Date: Mon, 28 Jul 97 12:00:25 -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           Mon, 28 Jul 1997     Volume: 8 Number: 787

Today's topics:
     Re: Assoc. array initialization query <sfairey@adc.metrica.co.uk>
     Re: Building perl5.004 with cygwin on NT4 failure (Pete Jordan)
     Re: Confirmation messages & bogus email addresses. Help (Pete Jordan)
     Re: Date::Manip Error (Steffen Beyer)
     Re: Displaying 1 html file in cgi, then second <eckje@rhodes.edu>
     Executing Shell commands in Perl wchrist@flagmail.wr.usgs.gov
     Extremely peculiar behavior in a loop in a subroutine <cherold@pathfinder.com>
     Re: function pointer dereferencing (Pete Jordan)
     Re: Help with RSH command ( Thomas Lachlan XMS x4206 )
     Re: Idea for a New Perl Book (Mark A. Lehmann)
     Re: interesting sorting problem (Daniel E. Macks)
     Re: interesting sorting problem <sfairey@adc.metrica.co.uk>
     Re: interesting sorting problem <sfairey@adc.metrica.co.uk>
     Re: interesting sorting problem <craig@mathworks.com>
     Need help finding crypt... (William [Billy] Harrison)
     PERL 5.004_1 bug? <mdudley@execonn.com>
     Re: Perl for dos in windows 95 (Matthew Burnham)
     Perl to C Converters <senthil@ece.vill.edu>
     perldb.pl core dump darren@prismweb.com
     Poetry questions (Toutatis)
     Re: python envy ? <vroonhof@frege.math.ethz.ch>
     Question on and associative arrays and -w switch <sartang@pcocd2.intel.com>
     Re: Question on and associative arrays and -w switch <garye@iname.com>
     Re: Question on and associative arrays and -w switch (M.J.T. Guy)
     redirection from STDERR (Teebu Philip)
     Re: Too many people in this group are arrogant #*(@# (R <jbokma@caiw.nl>
     Re: turning off "<variable name> used only once" warnin (M.J.T. Guy)
     Re: Unix time, local time, year 2000 question. (M.J.T. Guy)
     What do I need for DBD and Oracle to work...? (Mr R Hamilton)
     Re: where is FAQ, how to use $ENV <eckje@rhodes.edu>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 28 Jul 1997 18:11:50 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: simon twigger <simont@post.its.mcw.edu>
Subject: Re: Assoc. array initialization query
Message-Id: <33DCD2D5.9AD3E83E@adc.metrica.co.uk>

simon twigger wrote:

> Hi there,
>
> In previous versions of my scripts I have been initializing
> associative
> arrays before I use them using:
>
> %array = {};
>
> I was doing this as I believed it was a good idea, and also to ensure
> that the array was empty at that point and hadnt got anything else in
> it  that may have been left over from a previous invocation of the
> array.
>
> We just upgraded to perl 5.004 and now when I use the same line Im
> getting "Odd number of elements in hash list at..." errors at this
> line.
> I would like to know if Im initializing the array correcly, if I need
> to
> initialize it like this or if Im doing something that really isnt
> necessary. :)
>
> Thanks in advance
>
>         Simon.
>
> Simon Twigger
> Medical College of Wisconsin, Milwaukee
> simont@post.its.mcw.edu

 I believe arrays and hashes are initialised as empty to start with,
however clearing them is always worth doing if your code is ever going
to end up looping and you don't want the array/hash to grow.  I think {}
should normally be used to denote a BLOCK rather than an array/hash and
in the past I have always used () when clearing arrays/hashes ( whether
that is 100% correct I am not sure, but 5.004 doesn't complain. ).
I am not sure what the implications are of using {}, I doubt there are
any but I think the syntax checking in 5.004 has been enhanced
significantly so that you can no longer get away with things which are
strictly speaking not syntactically correct; whereas you could with
earlier versions.

Simon



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

Date: Mon, 28 Jul 1997 18:22:34 GMT
From: pete@horus.cix.vapethis.co.uk (Pete Jordan)
Subject: Re: Building perl5.004 with cygwin on NT4 failure
Message-Id: <memo.19970728192233.27829I@horus.cix.co.uk>

In article <5rh9hi$kk3$1@lennon.postino.com>, danny@lennon.postino.com
(Danny Aldham) wrote:

> Using GNU-win32 b18 gcc to build perl5.004_01 , I am getting to the point
> of compiling miniperl when the make fails with:
>  gcc2 -o miniperl miniperlmain.o libperl.a -lcygwin -lm -lc -lkernel32
>  libperl.a(pp_sys.o)(.text+0x602f):pp_sys.c: undefined reference to `setp
> went'
>  gcc: Internal compiler error: program ld got fatal signal 1
>  make: *** [miniperl} Error 1

Add -DCYGWIN32 to your ccflags - there are a couple of source files that
have conditional compilation set on CYGWIN32 rather than __CYGWIN32__ as
they should.

You should also be using Chris Faylor's patches (from
http://www.tiac.net/users/cgf). See the cygwin32 mailing list for more...

Pete Jordan
= = = = = = = = = = = = = = = = = = = = = = =
Horus Communications
http://www.horus.cix.co.uk/
= = = = = = = = = = = = = = = = = = = = = = =
"Is a polar bear a rectangular bear after
 a coordinate transform?"



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

Date: Mon, 28 Jul 1997 16:49:49 GMT
From: pete@horus.cix.vapethis.co.uk (Pete Jordan)
Subject: Re: Confirmation messages & bogus email addresses. Help!
Message-Id: <memo.19970728174949.27829H@horus.cix.co.uk>

In article <869637799.27117@dejanews.com>, robynn@vastnet.net (Robyn
Wagner) wrote:
>     I was very suprised to find out that if customer submits a "bogus
> email address" it does not return an error message appended to the
> unsendable "Web Order Customer Copy" to the storefront adminastrator.
> I assumed that all letters with incorrect/false email addresses were
> returned to the sender (in this case orders@orders.com!But how come
> this is not the outcome with an  online form which sends a
> confirmation message to the bogus email address submitted? Doesn't
> sendmail always return a copy that says "undeliverable" to the FROM
> address? If not, where does the message go?!?

You need "sendmail -t -f $bounceAddress"; this will set the from address
for the mail and ensure that bounces get directed there.

Be warned though that sendmail may be configured not to allow this (to
prevent spoofing). Even if it does work, you'll probably get an
"X-Authentication-Warning:" header line in the mail sent.

Pete Jordan
= = = = = = = = = = = = = = = = = = = = = = =
Horus Communications
http://www.horus.cix.co.uk/
= = = = = = = = = = = = = = = = = = = = = = =
"Is a polar bear a rectangular bear after
 a coordinate transform?"



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

Date: 28 Jul 1997 14:08:54 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Date::Manip Error
Message-Id: <5ri95m$kha$1@en1.engelschall.com>

J. Paul Reed <preed@psd.k12.co.us> wrote:

> I installed the Date::Manip module, and put use Manip in my perl code.
> But, now whenever I run whatever script I put that use Manip in, it says:


> Can't call method "import" in empty package "DateManip" at script.pl line 56.
> BEGIN failed--compilation aborted at script.pl line 56.

> I just installed it, and did move Manip.pm around to another directory,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> plus renamed it do DateManip.pm. Other than that, the install went fine;
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Do you think Perl can read minds?! Surely you are joking...

Or else you should apply for the "most stupid question" award in the
Guinness Book of Records...

> no error messages (other than I had to install it as root after I got done
> cofiguring it, which I did).

> Any help on what this means would be appreciated!

IMHO, your system administrator should change his root password ASAP!

Yours,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: Mon, 28 Jul 1997 10:38:00 -0500
From: Jay Eckles <eckje@rhodes.edu>
Subject: Re: Displaying 1 html file in cgi, then second
Message-Id: <33DCBCD0.1EDF@rhodes.edu>

The kludge for the problem is to include a meta refresh tag in your
first html file.  In the URL attribute of the meta tag, put the address
either of a page that your perl script will write to disk or to a script
to dynamically create the page.

Jay


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

Date: Mon, 28 Jul 1997 12:53:06 -0600
From: wchrist@flagmail.wr.usgs.gov
Subject: Executing Shell commands in Perl
Message-Id: <870110598.30566@dejanews.com>

I am trying to execute shell commands in Perl with no success.  The
shell version of what I am trying to do is as follows:

#!/bin/sh

taetm << done
isisdoc FROMPDF=test.pdf
exit
done


How do I translate this to perl?  Taetm is an application, and isisdoc
is a program run under this application.  The FROMPDF=test.pdf is an
argument passed to isisdoc, with the exit call terminating the taetm
application after isisdoc is finished running.

I have tried to execute this in perl with both the system() call and
the Shell module.  Any help in this matter would be greatly appreciated!

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


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

Date: Mon, 28 Jul 1997 13:41:16 +0100
From: Charles Herold <cherold@pathfinder.com>
Subject: Extremely peculiar behavior in a loop in a subroutine
Message-Id: <33DC935E.72D6@pathfinder.com>

Please look at the subroutine below.  The problem is the if statement. 
At first, where I now have "$level = 0" I had "next", but that exited
the entire subroutine with the message:

Exiting subroutine via next at final line 139, <STDIN> chunk 2 (#1)
Exiting subroutine via next at final line 139, <STDIN> chunk 2.

So then I changed it to what you see below.  Now in all my years of
programming it has always been my experience that setting a test
variable to a number guaranteed to fail will cause the conditional test
to fail, but in this case if the user enters something that doesn't
begin with a digit, $level is set to 0 and 0 is returned.

Why?

sub getNumber
{
  local ($maxNum) = @_;
  local($level);

 do {
    $level = <STDIN>;
    if ($level !~ /^\d/) {
      print "please enter a number\n";
      $level = 0;
    }
  } while ($level < 1 && $level > $maxNum);

  $level;
}

-- 
Best regards,

       Charles Herold
         Pathfinder
          Production Assistant
           cherold@pathfinder.com
             (212) 522-5190


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

Date: Mon, 28 Jul 1997 16:49:48 GMT
From: pete@horus.cix.vapethis.co.uk (Pete Jordan)
Subject: Re: function pointer dereferencing
Message-Id: <memo.19970728174947.27829G@horus.cix.co.uk>

In article <Pine.GSO.3.96.970716220329.18795D-100000@kelly.teleport.com>,
rootbeer@teleport.com (Tom Phoenix) wrote:

> So, this syntax is now a feature in version 5.004.
>
>     $result = $coderef->($parameter, $another);

Woo! And not only that, but:

	#!/usr/bin/perl

	foo(sub {print 'hello, ', join(', ', @_), "!\n"});

	sub foo {
	  my $bar=shift;

	  $bar->('Tom', 'Randal', 'Larry');
	}

works too. Anyone remember Algol68?

Nice one... :)

Pete Jordan
= = = = = = = = = = = = = = = = = = = = = = =
Horus Communications
http://www.horus.cix.co.uk/
= = = = = = = = = = = = = = = = = = = = = = =
"Is a polar bear a rectangular bear after
 a coordinate transform?"



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

Date: 28 Jul 1997 13:03:47 GMT
From: etltsln@etlxd30.ericsson.se ( Thomas Lachlan XMS x4206 )
Subject: Re: Help with RSH command
Message-Id: <5ri5bj$8k9@newstoo.ericsson.se>

Hi Pui,
	Something like this perhaps:

	for($var_for_case)
	{
		SWITCH: {
			/^1/ && do {
					print "DHJHFJHJ\n";
					};
			/^2/ && do {
					print "Baseballs\n";
					};
				}
	}

		Hope this helps.
				Regds Tom.


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

Date: 28 Jul 1997 12:14:09 -0500
From: mlehmann@prismnet.com (Mark A. Lehmann)
Subject: Re: Idea for a New Perl Book
Message-Id: <5bracjm74u.fsf@smokey.prismnet.com>

Doesn't 4Q97 mean 23:59:59.99 1997/12/31?

jtbell@presby.edu (Jon Bell) writes:

> 
> In article <5rd24d$8ih@news-central.tiac.net>,
> Mike Stok <mike@stok.co.uk> wrote:
> >
> >ETA: 4Q97 probably means estimated time of arrival fourth quarter of 1997,
> >so it should be soon with the caveats that publishing companies and
> >authors use the word "estimated" advisedly :-)
> 
> That is, just the way that programmers and/or their managers use it.
> :-)  :-)
> 
> -- 
> Jon Bell <jtbell@presby.edu>                        Presbyterian College
> Dept. of Physics and Computer Science        Clinton, South Carolina USA

-- 
Mark Lehmann.


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

Date: 28 Jul 1997 16:00:39 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: interesting sorting problem
Message-Id: <5rifn7$45e$1@netnews.upenn.edu>

Craig Ciquera (craig@mathworks.com) said:
: Sorry, I should have been more specfic.  I would like to obtain the
: foillowing from the list below:
: 
: 0.0.2.2 
: 0.0.3.0.1.0
: 0.0.4.0
: 1.0.1.0
: 1.0.1.1
: 2.0.0.2
: 17.0
: 17.6
: 18.0.0.2
: 34.1
: 
: So basically, I would like to sort on all '.' separated fields and have
: the output appear in ascending order.

Perhaps something like Sort::PolySort, which has a broken Makefile but
also does sort-by-IP.

dan

-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: Mon, 28 Jul 1997 18:02:13 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Craig Ciquera <craig@mathworks.com>
Subject: Re: interesting sorting problem
Message-Id: <33DCD094.6503F425@adc.metrica.co.uk>

Craig Ciquera wrote:

> Sorry, I should have been more specfic.  I would like to obtain the
> foillowing from the list below:
>
> 0.0.2.2
> 0.0.3.0.1.0
> 0.0.4.0
> 1.0.1.0
> 1.0.1.1
> 2.0.0.2
> 17.0
> 17.6
> 18.0.0.2
> 34.1
>
> So basically, I would like to sort on all '.' separated fields and
> have
> the output appear in ascending order.
>
> Thanks Again,
> Craig
>
> Simon Fairey wrote:
> >
> > Craig Ciquera wrote:
> >
> > > Hello,
> > >
> > > I have the following example set of numbers:
> > >
> > > 1.0.1.0
> > > 1.0.1.1
> > > 17.0
> > > 17.6
> > > 2.0.0.2
> > > 18.0.0.2
> > > 34.1
> > > 0.0.4.0
> > > 0.0.2.2
> > > 0.0.3.0.1.0
> > >
> > > I'm looking for ideas on how to best sort these???
> > >
> > > Thanks,
> > >
> > > Craig
> >
> >   Ummmm. Ascending, descending, on the first '.' seperated field or
> on
> > the last, etc..
> >
> > Can you elaborate on how exactly you want to sort the above.
> >
> > Simon
> > 'always willing to help if he can understand the problem :-)'

  OK try using the following sort function:

sub multi{
        my @alist = split /\./, $a;
        my @blist = split /\./, $b;

        # Only check the first x values where x is the smaller
        # of the two arrays.
        my $num = @alist > @blist ? @blist : @alist;

        my $compare = '';

        # Build up the string to be evaluated.
        for( $i = 0; $i < $num; $i++ ) {
                $compare .= " $alist[$i] <=> $blist[$i] or ";
        }

        # Lose the extra 'or' at the end.
        $compare =~ s/ or $//;

        return eval($compare);
}

So assuming you have read your data into @data then just do:

@sorted_data = sort multi @data;

Now I make no bones about the efficiency of this as this is just the
first thing which came to mind. It should at least get you on your way
but I have not checked it thoroughly ( although it works for your data
). The for loop would probably be best replaced by a while which shifts
the values out of @alist and @blist, rather than using subscripts.
Either way if your data is only small this may well suffice, or at the
very least give you some ideas.

Simon



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

Date: Mon, 28 Jul 1997 14:57:28 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Craig Ciquera <craig@mathworks.com>
Subject: Re: interesting sorting problem
Message-Id: <33DCA547.54F18015@adc.metrica.co.uk>

Craig Ciquera wrote:

> Hello,
>
> I have the following example set of numbers:
>
> 1.0.1.0
> 1.0.1.1
> 17.0
> 17.6
> 2.0.0.2
> 18.0.0.2
> 34.1
> 0.0.4.0
> 0.0.2.2
> 0.0.3.0.1.0
>
> I'm looking for ideas on how to best sort these???
>
> Thanks,
>
> Craig

  Ummmm. Ascending, descending, on the first '.' seperated field or on
the last, etc..

Can you elaborate on how exactly you want to sort the above.

Simon
'always willing to help if he can understand the problem :-)'



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

Date: Mon, 28 Jul 1997 10:03:30 -0500
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: interesting sorting problem
Message-Id: <33DCB4C2.5F1C@mathworks.com>

Sorry, I should have been more specfic.  I would like to obtain the
foillowing from the list below:

0.0.2.2 
0.0.3.0.1.0
0.0.4.0
1.0.1.0
1.0.1.1
2.0.0.2
17.0
17.6
18.0.0.2
34.1


So basically, I would like to sort on all '.' separated fields and have
the output appear in ascending order.

Thanks Again,
Craig

Simon Fairey wrote:
> 
> Craig Ciquera wrote:
> 
> > Hello,
> >
> > I have the following example set of numbers:
> >
> > 1.0.1.0
> > 1.0.1.1
> > 17.0
> > 17.6
> > 2.0.0.2
> > 18.0.0.2
> > 34.1
> > 0.0.4.0
> > 0.0.2.2
> > 0.0.3.0.1.0
> >
> > I'm looking for ideas on how to best sort these???
> >
> > Thanks,
> >
> > Craig
> 
>   Ummmm. Ascending, descending, on the first '.' seperated field or on
> the last, etc..
> 
> Can you elaborate on how exactly you want to sort the above.
> 
> Simon
> 'always willing to help if he can understand the problem :-)'


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

Date: 28 Jul 1997 15:08:57 GMT
From: harrison@ug.cs.dal.ca (William [Billy] Harrison)
Subject: Need help finding crypt...
Message-Id: <5ricm9$9jl$1@News.Dal.Ca>

Hello.

I know what I need to do with crypt in order to solve my problem, but 
it's not installed on my system.  Can anyone tell me how to get a copy of 
the function for my own use?  Is it part of the standard library, or is 
it somewhere else?  Thanks for your time.

--
 _________________________________________________________________
|  William Harrison			harrison@ug.cs.dal.ca     |
|								  |
|  Student at Dalhousie University, Halifax, NS, Canada,          |
|  e-wrestling participant, video game lover and Internet junkie  |
|_________________________________________________________________|


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

Date: Mon, 28 Jul 1997 10:58:27 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: PERL 5.004_1 bug?
Message-Id: <33DCB393.53C3@execonn.com>

I think I have found a bug in PERL 5.004_1.  The printf left
justification does not work.  Even with the "-" 
(ie. %-8.2f) it still prints right justified.

Is there a workaround for this?

Thanks,

Marshall


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

Date: Mon, 28 Jul 1997 17:41:17 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: Perl for dos in windows 95
Message-Id: <33e48001.3703553@194.72.192.4>

Marshall Dudley <mdudley@execonn.com> wrote:

>If anyone could point me to where I might be able to download a copy of
>PERL 5 already compiled for 32 bit Windows DOS platform that will not
>crash on large hashes, I would appreciate it.
You could try www.activeware.com, which I use very successfully, but I
haven't tested where their port crashes with big hashes.


-- 
Matthew Burnham, Manager, MindWeb | danew@enterprise.net
Commercial web design and hosting, reasonable rates
UKP24/Mb/Year for DIY space | mindweb@pobox.co.uk
FTP, CGI, password protection, etc. too!
http://www.mindweb.co.uk/


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

Date: Mon, 28 Jul 1997 13:35:20 -0400
From: Senthilvel Rangaswamy <senthil@ece.vill.edu>
Subject: Perl to C Converters
Message-Id: <Pine.SV4.3.95.970728133448.4142A-100000@vu-vlsi.ee.vill.edu>

Hi,

Could anybody please point me to some info about
good Perl to C convertors.

Thanks,

 ..Senthil

"Out the 10Base-T, through the router, down the T1, over the leased line,
 off the bridge, past the firewall.... nothing but Net."
						       - Todd Postma



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

Date: Mon, 28 Jul 1997 11:03:50 -0600
From: darren@prismweb.com
Subject: perldb.pl core dump
Message-Id: <870094638.14341@dejanews.com>

Hello,

I recently installed perl5002 (I know it's not the newest) on Interactive
UNIX.  I am getting "Floating exception(coredump)" when Itry to use the
debugger.  I have tried to find a fix, but have been unsuccessful.  Can
anyone point me in the right direction?

Thanx,

Darren

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


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

Date: 28 Jul 1997 18:46:20 GMT
From: toutatis@remove.this.toutatis.net (Toutatis)
Subject: Poetry questions
Message-Id: <toutatis-ya023180002807972046280001@news.euro.net>

How to write cleaner scripts:

$var2 = $var;
$var2 =~ tr/qwerty/asdfg/;

Can I do that in a single statement?
like: $var2 = $var =~ tr/qwerty/asdfg/;
But then in a way that it does what I want?

Another one:
$var = $long->{'variable'}->{'name'} ? $long->{'variable'}->{'name'} : "nope";
Is there a way so I don't have to write that long variable name twice?

-- 
Toutatis


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

Date: 28 Jul 1997 16:59:34 +0200
From: Jan Vroonhof <vroonhof@frege.math.ethz.ch>
Subject: Re: python envy ?
Message-Id: <byyb6rz0h5.fsf@midget.math.ethz.ch>

arw@lucent.com writes:

> is).  This does breed a certain defensiveness in the Python community,
> especially when we are regularly flamed by Perlers.

In a thread similar to this (I think the message is on his website)
Tom Cristiansen (Sp?) once wrote something to the effect of. "If there
wasn't Perl, I would be writing in Python". This is probably the
among the best compliments any language can get.

Ja


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

Date: Mon, 28 Jul 1997 10:02:50 -0700
From: Saviz Artang - MPG ~ <sartang@pcocd2.intel.com>
Subject: Question on and associative arrays and -w switch
Message-Id: <33DCD0BA.41C6@pcocd2.intel.com>

Hi, I'm having a particular problem that someone out there hopefully 
knows the answer to: 

I use the perl -w switch because it catches a lot of my mistakes. 

The problem I'm having is that I'm using an associative array to 
represent a hash of a list that I have.  I do searches through 
this hash and when things are found every thing is good 
but when things are not found in this associative array the 
-w causes the code to spit out warnings saying an uninitialize 
value was used, since I have an if statement to see if the 
item was there or not:  

if ( a{"key"} ) { 
	print "found it" ; 
}
else { 
	print "didn't find it"; 
}


Now I understand the reason the warning is being produced but 
I want to perform this same thing on my hash for searching instead 
of going through a list linearly. So how can I do that and still 
avoid the warning ?? 

thanks 
saviz


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

Date: Mon, 28 Jul 1997 14:41:09 -0400
From: Gary Ebert <garye@iname.com>
To: Saviz Artang - MPG ~ <sartang@pcocd2.intel.com>
Subject: Re: Question on and associative arrays and -w switch
Message-Id: <33DCE7C5.60B8@iname.com>

Saviz Artang - MPG ~ wrote:
> 
> Hi, I'm having a particular problem that someone out there hopefully
> knows the answer to:
> 
> I use the perl -w switch because it catches a lot of my mistakes.
> 
> The problem I'm having is that I'm using an associative array to
> represent a hash of a list that I have.  I do searches through
> this hash and when things are found every thing is good
> but when things are not found in this associative array the
> -w causes the code to spit out warnings saying an uninitialize
> value was used, since I have an if statement to see if the
> item was there or not:
> 
> if ( a{"key"} ) {
>         print "found it" ;
> }
> else {
>         print "didn't find it";
> }
> 
> Now I understand the reason the warning is being produced but
> I want to perform this same thing on my hash for searching instead
> of going through a list linearly. So how can I do that and still
> avoid the warning ??
> 
> thanks
> saviz

replace 
if (a{"key"}) {
with
if ( exists (a{"key"}) ) {
and that should take care of it!!!

	Gary

-- 
Gary Ebert                                 Operations Administrator
Voice:     (301) 428-2115                  Mobile Datacom Corporation
Fax:       (301) 428-1004                  19540 Amaranth Drive
Pager:     (800) 490-7478                  Germantown, MD  20875-2126


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

Date: 28 Jul 1997 18:35:02 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Question on and associative arrays and -w switch
Message-Id: <5rioom$sq@lyra.csx.cam.ac.uk>

Saviz Artang - MPG ~  <sartang@pcocd2.intel.com> wrote:
>The problem I'm having is that I'm using an associative array to 
>represent a hash of a list that I have.  I do searches through 
>this hash and when things are found every thing is good 
>but when things are not found in this associative array the 
>-w causes the code to spit out warnings saying an uninitialize 
>value was used, since I have an if statement to see if the 
>item was there or not:  
>
>if ( a{"key"} ) { 

Make that test

 if ( exists $a{"key"} ) {

(I assume the missing $ was just a typo.)

See "exists" in the perlfunc man page, or (if you have perl5.004) just do

     perldoc -f exists


Mike Guy


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

Date: 28 Jul 1997 14:07:58 GMT
From: tphilip@bnr.ca (Teebu Philip)
Subject: redirection from STDERR
Message-Id: <5ri93u$g3v@brtph500.bnr.ca>


Hello.

I wish to call an executable program xyz from within a perl script bubba.pl.
The program xyz redirects STDERR into STDOUT.  I wish to seperate the STDERR
messages from STDOUT from within my perl script.  Normally at the shell prompt
I could do the following:

brtphe33-132> (xyz > file.stdout) >& file.stderr

I have tried some of the standard techniques for talking to oneself using the
open with "|-" and having the parent talk with the child, but when I execute
xyz from my perl script, I do not control the output of STDERR and it appears
at the screen from my perl script.

If anyone could give any insight on my problem, I would really appreciate it.
Thanks.

Teebu
-- 
Teebu Philip         EMAIL: tphilip@nortel.ca
NORTEL (RTP Lab)     XPM Diagnostic Development, Dept. 3X41
35 Davis Dr.         Voice: (919) 991-2602    ESN: 294-2602
RTP, NC  27709       FAX:   (919) 991-4126    ESN: 294-4126


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

Date: 28 Jul 1997 18:12:12 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Too many people in this group are arrogant #*(@# (Re: Checking for valid Email...)
Message-Id: <01bc9b81$cf73f1e0$de0ab2c2@tschai>



Alan J. Flavell <flavell@mail.cern.ch> wrote in article
<Pine.A41.3.95a.970728135852.111678C-100000@sp049>...
> On 28 Jul 1997, John Bokma wrote:
> 
> ...
> > Providers don't teach people
> > to go to news.answers before starting to use USENET.
> 
> Too bad.  Before it became September all year round, newsreaders
came
> with news.announce.newusers pre-subscribed, and newbies were
expected to
> do their homework.  Now it seems we are expected to re-negotiate
the
> terms of engagement every day, instead of concentrating on the
topic.
> 
> > See the example above. 
> 
> Sometimes people make mistakes.  Nothing that you or I can say will
> change that, so live with it.  I don't see how such individual
mistakes
> discredit the general principle. 
> 
> > The FAQ is (and will) never be complete.
> 
> Who suggested that such a thing could be possible or even
desirable?
> 
> It only reinforces the point that if a quality answer is ready and
> waiting in the relevant FAQ, it's foolish to ask for (and
> counterproductive to give) a random off-the-top-of-head answer
here. 

Isn't "It's in the FAQ" just such an answer?

John


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

Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)

http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]

email: jbokma@caiw.nl  phone: +31 10 4291827



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

Date: 28 Jul 1997 16:52:55 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: turning off "<variable name> used only once" warning
Message-Id: <5riip7$prv@lyra.csx.cam.ac.uk>

Jeffrey J. Barrett <gt5146c@acmez.gatech.edu> wrote:
>
>	Thanks to everyone for the replies.  Let me be a little more
>specific as to where this is occuring.  I am using the library routine
>Getopt::Std to allow for easy command line parsing.  My script can take
>one flag, an 'f'.  
>	In case you aren't familiar with it, the way this library is used
>is with a 'getopt( 'f' )'.  If an 'f' flag was given to the script, this
>call will create a variable called '$opt_f' and set its value to '1'.  I
>only need to access this variable once, in an if statement to see if it
>exists/is set to 1. 

I think you want this paragraph from the documentation of Getopt::Std :

     For those of you who don't like additional variables being
     created, getopt() and getopts() will also accept a hash
     reference as an optional second argument. Hash keys will be
     x (where x is the switch name) with key values the value of
     the argument or 1 if no argument is specified.


Mike Guy


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

Date: 28 Jul 1997 16:27:13 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Unix time, local time, year 2000 question.
Message-Id: <5rih91$oht@lyra.csx.cam.ac.uk>

In article <EDytn7.4E5@nonexistent.com>, Abigail <abigail@fnx.com> wrote:
>A few oddities on my platform:
>
>The roll over doesn't seem to happen till a few hours later:
>$ perl -wle 'print scalar localtime (0x8000383F)'
>Tue Jan 19 03:14:07 2038
>$ perl -wle 'print scalar localtime (0x8000383F + 1)'
>Fri Dec 13 20:45:52 1901
>
>However, there's an extra leap of an hour after the roll over:
>$ perl -wle 'print scalar localtime (0x7FFFFFFF + 1)'
>Mon Jan 18 23:14:08 2038

These effects occur because you are doing "localtime" rather than "gmtime".
Since Unix internal times are GMT, you get different effects depending
on whether the timezone adjustment is done before or after the point
where the wrapround occurs.


Mike Guy


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

Date: 28 Jul 1997 16:15:21 +0100
From: csrax@csv.warwick.ac.uk (Mr R Hamilton)
Subject: What do I need for DBD and Oracle to work...?
Message-Id: <5rid29$2v8@crocus.csv.warwick.ac.uk>


Hiya!

I've got Personal Oracle 7.3.3.0.0 on an NT box, and I'd like to
access it from some Perl programs. I'd actually prefer to run the Perl
stuff on another machine (a Netra running Solaris 2.5) and connect
across the network - is that possible, and will I need anything other
than the DBI and DBD::Oracle packages?  If not, then can I do it by
putting Perl 5.04 and the DBI/DBD stuff on the NT box?

Thanks,
Ross

 .-------Ross Hamilton, PhD Student in the History of Computing-------.
| http://www.dcs.warwick.ac.uk/~ross | mailto:ross@dcs.warwick.ac.uk |
|    Department of Computer Science, | 12 Newbold Place, Leamington  |
| Uni. of Warwick, Coventry, CV4 7AL | Spa, Warwks, CV32 4HR, UK     |
`-------------- Office: 01203 528043 | Home: 01926 886146 -----------'



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

Date: Mon, 28 Jul 1997 11:24:34 -0500
From: Jay Eckles <eckje@rhodes.edu>
Subject: Re: where is FAQ, how to use $ENV
Message-Id: <33DCC7B7.71AE@rhodes.edu>

Thanks to everyone who responded to my questions (many by email).  I've
got a lot of reading to do with teh faq and man pages, etc.

Jay


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

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

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