[7103] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 728 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 12 20:07:51 1997

Date: Sat, 12 Jul 97 17:01:42 -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           Sat, 12 Jul 1997     Volume: 8 Number: 728

Today's topics:
     I'm in tty hell <tex@collegenet.com>
     Is remote registry administration possible for WindowsN (Mark Nielsen)
     Re: Long $trings in s///g (M.J.T. Guy)
     Lotus Notes && PERL <menzel@anastasis.hebron.lnet>
     Re: Lotus Notes && PERL <uma@heidelbg.ibm.com>
     lower case in directory? (John Liao)
     Re: lower case in directory? <rootbeer@teleport.com>
     Re: lower case in directory? (Quentin Fennessy)
     Re: Mail::Send problem SOLVED! (Uli Zappe)
     Re: making refs in while() elegantly... (Andrew M. Langmead)
     Re: Net::NNTP missing newsgroups? lvirden@cas.org
     Newbie needs help with searching an array <petergi@synopsys.com>
     Re: no. of days between two dates ? <brodzik@zamboni.colorado.edu>
     Re: Open File on another server? <rootbeer@teleport.com>
     Re: Perl 5.003 -> 5.004_1 migration (Simon Hyde (aka Jeckyll))
     Re: Perl install location <will@cs.ucr.edu>
     Re: Perl is 20 times slower on Cray J90 than SGI! <sibsib@hotmail.com>
     Re: PERL system call (Tad McClellan)
     Re: perl w/ mysql - insert? (Jay Flaherty)
     Re: perl w/ mysql - insert? <bfc@porte.com>
     Problem writing to binary file (Rich)
     Reading a document in www <eedjef@eed.ericsson.se>
     Re: Regular experssions and delimiters. <rootbeer@teleport.com>
     Re: reverse chop? (Jeff Stampes)
     Re: reverse chop? <royl@netropolis.net>
     Re: Sending mails from perl (Jean-Damien Durand)
     Sorting Numerically <jefpin@bergen.org>
     Re: Sorting Numerically <sfairey@adc.metrica.co.uk>
     Re: Speed differences when passing array to function by <rootbeer@teleport.com>
     Strategies for dealing with the 'Use of uninitialized v (Danny Yarbrough)
     Re: Strategies for dealing with the 'Use of uninitializ (view archives)
     tr.problem (Fan Ng)
     Tracking running time?? <ashfield.matthew@miti.nb.ca>
     Re: use //require (Randy J. Ray)
     Re: Using .forward file to start a perl script (Nathan V. Patwardhan)
     Re: Want benefit of 'my' variables in a package (M.J.T. Guy)
     Re: What is Perl syntax for SELECT CASE? <tex@collegenet.com>
     what's going on here?? (Fan Ng)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 11 Jul 1997 18:52:37 -0700
From: Austin Schutz <tex@collegenet.com>
Subject: I'm in tty hell
Message-Id: <33C6E365.42@collegenet.com>

Well not really but it's fun to type.

	While announcing an Expect module last week I complained about 
a lack of a grantpt() function under perl. that is, a function that
temporarily changes ownership of a tty from root to the user, opens the
tty and returns a file descriptor, much like login does to your tty when
you log in. try ls -l `tty`. Notice the perms.
	tcl's expect also demonstrates why this would be a good thing. For
shits and giggles try:

$ cat > ./temp.exp
#!/usr/local/bin/expect
spawn ftp
interact
^D
$ chmod +x !$ (you all use bash don't you? :-)

	Now do trace/strace/truss/whatever on this script and look for
the pty it opens (or use lsof). On my linux box it opened /dev/ptypa and
/dev/ttypa (for the child process ftp).

On a different window:

frank:~$ ls -l /dev/ttypa
crw-rw-rw-   1 root     root       3,  10 Jul 11 18:21 /dev/ttypa
frank:~$ 

	Hmm...

frank:~$ echo 'yo mama so fat etc. etc.' > /dev/ttypa
frank:~$

	Meanwhile back at the Batcave:

frank:~$ ./temp.exp
spawn ftp 
ftp> yo mama so fat etc. etc.

	My guess is that if you were to read from /dev/ttypa it would set up an
unpredictable race condition. It didn't seem to do anything
on the linux box but it may be that it would if there were large amounts
of data being passed.

	How many times have you passed a password in an expect script? Would it
be worth posting this to a security list like Bugtraq?

	You may be asking yourself why it is the descriptor isn't just opened
exclusively. Well, that's because many programs write directly to
/dev/tty instead of being nice and using STDOUT. If you lock it these
programs will bust.

-- Begin minor rant --

	Why is it for all the POSIX specs there is no uniform way to open a
tty? It's possible to set the most obscure flags using the termios
interface but not possible to just open one of the bloody things
properly in any sort of minutely portable way. 

-- End rant --

	Here's an excerpt from 'man -s 3C grantpt':

SYNOPSIS
     int grantpt(int fildes);

MT-LEVEL
     Safe

DESCRIPTION
     The function grantpt() changes the mode and ownership of the
     slave  pseudo-terminal  device  associated  with  its master
     pseudo-terminal counter part.  fildes is the file descriptor
     returned  from  a  successful  open  of  the  master pseudo-
     terminal device.


	This is from a SunOS 5.5 box. I'm not sure if any other such animals
exist on other platforms or what they would be called. But it would be
very very nice if perl included such a method as part of its base stock.
This would be a bit of a pain since each OS has its own home-brewed
version of this function but once it was in perl it could be used on any
platform and you would never see me ranting about it ever again :-).


	Tex


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

Date: 11 Jul 1997 13:10:06 -0400
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Is remote registry administration possible for WindowsNT?
Message-Id: <5q5pde$js0$1@auto.med.ohio-state.edu>

I recently made a bunch of perl scripts uisng regini and regdmp to make 
registry changes to computers remotely.

I downloaded the latest version of perl for WindowsNT and looked at the
Win32 module. It has some abilities to change registry locally, but it would
be cool if it could change it remotely. 

Does anybody know if there are plans to develop the perl module to be able to
change registry entries remotely?


Mark    
-- 
---------------------------------------------------------------------------
Mark Nielsen	men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University


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

Date: 11 Jul 1997 10:20:47 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Long $trings in s///g
Message-Id: <5q51dv$gfh@lyra.csx.cam.ac.uk>

In article <33C3A38E.504F@bnr.ca>, Gregor Binder  <binder@bnr.ca> wrote:
>$set =~ s/$oldstring/$newstring\n/g;
>
>This works fine for $oldstring up to a
>certain length (didn't figure out how
>long it CAN be ..), if it exceeds this
>length, the s///g won't happen :-(((

There is a limit on the size of a regular expression  -  about 32768.
(The regexp, that is.   There's no limit on the string being tested.)

Are your regexps that big?   I rather doubt it, unless they're machine
generated.     Perhaps your $oldstring contains metacharacters like * or ?.
If so, you should quote them if appropriate:

 $set =~ s/\Q$oldstring\E/$newstring\n/g;

If neither of the above applies, you'd better explain what you mean by
"the s///g won't happen".    I'm sure it does happen, but doesn't produce
the results you expect.    Please post sample regexp, input string and
expected output, and we may be able to help further.


Mike Guy


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

Date: 11 Jul 1997 09:08:13 GMT
From: Olaf Menzel <menzel@anastasis.hebron.lnet>
Subject: Lotus Notes && PERL
Message-Id: <5q4t5t$3ra@anastasis.tfh-berlin.de>

Hello,
-------
I am writing on a project for solving the IP-traffic of our LAN.
Therefore I have a Accounting Daemon working on a UNIX machine. I ist
written in PERL.
I like to put the accouting data to a Notes database. Does anybody know of a
PERL - Notes API. I don't like to put the data first to SQL-Database, like
DB-2 or Sybase and import the data from Sybase with Notes.

Thank you for your help

Olaf



-- 
---
OLAF MENZEL    < menzel@tfh-berlin.de >
Maximilianstr. 12 B | D-13187 Berlin    | GERMANY | Tel: +49 30 47303266
"Where the Spirit of the Lord is,there is liberty." Bible: 2.Cor. 3:17



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

Date: Fri, 11 Jul 1997 14:48:27 +0200
From: Uma Shanker <uma@heidelbg.ibm.com>
To: Olaf Menzel <menzel@anastasis.hebron.lnet>
Subject: Re: Lotus Notes && PERL
Message-Id: <33C62B9B.6201@heidelbg.ibm.com>

Olaf Menzel wrote:
> 
> Hello,
> -------
> I am writing on a project for solving the IP-traffic of our LAN.
> Therefore I have a Accounting Daemon working on a UNIX machine. I ist
> written in PERL.
> I like to put the accouting data to a Notes database. Does anybody know of a
> PERL - Notes API. I don't like to put the data first to SQL-Database, hello Olaf,
	we also spended lots of time looking after Notes - Perl interface. At
last we are doing like this.
Our agent is running in domino, which reqularly reads data files(ascii)
, created by PERL Programms. 
Not a good idea but its working because we don't wanna change existing
PERL programms so much. And don't want to write in lotus script so much. 
-- 
uma shanker           
uma@heidelbg.ibm.com
bad mail go to /dev/null <<


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

Date: 11 Jul 1997 15:21:11 GMT
From: johnliao@cs.buffalo.edu (John Liao)
Subject: lower case in directory?
Message-Id: <5q5j17$fiq@prometheus.acsu.buffalo.edu>


in my current directory right now, i have 30 files that are in 
upper case. what is the fastest way to change them to lower cases
with out changing them one by one?
-- 
        _/            _/                  _/  _/                     
             _/_/    _/_/_/    _/_/_/    _/        _/_/_/    _/_/    
      _/  _/    _/  _/    _/  _/    _/  _/  _/  _/    _/  _/    _/   
     _/  _/    _/  _/    _/  _/    _/  _/  _/  _/    _/  _/    _/    


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

Date: Fri, 11 Jul 1997 09:23:26 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: John Liao <johnliao@cs.buffalo.edu>
Subject: Re: lower case in directory?
Message-Id: <Pine.GSO.3.96.970711091707.10200U-100000@kelly.teleport.com>

On 11 Jul 1997, John Liao wrote:

> in my current directory right now, i have 30 files that are in 
> upper case. what is the fastest way to change them to lower cases
> with out changing them one by one?

Just write a perl script to rename them. 

    perl -e 'for (@ARGV) { rename $_, lc($_) unless -e lc($_) }' *

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 11 Jul 1997 21:47:09 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: lower case in directory?
Message-Id: <5q69kt$dq0$1@amdint2.amd.com>

In article <5q5j17$fiq@prometheus.acsu.buffalo.edu>,
John Liao <johnliao@cs.buffalo.edu> wrote:
>in my current directory right now, i have 30 files that are in 
>upper case. what is the fastest way to change them to lower cases
>with out changing them one by one?

Like this (sh/ksh/bash)

	for x in * .[A-Z]*
	do	
		if expr $x : '[A-Z]*$'
		then
			mv $x `echo $x | dd conv=lcase`
		fi
	done



-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: 12 Jul 1997 17:53:51 GMT
From: uli@tallowcross.uni-frankfurt.de (Uli Zappe)
Subject: Re: Mail::Send problem SOLVED!
Message-Id: <5q8gbf$fnk$1@grapool30.rz.uni-frankfurt.de>

Hi,

Guy Decoux <decoux@moulon.inra.fr> provided the solution:

> Try to specify another mailer, like sendmail :
> [...]
> $MAILHANDLE = $MAIL->open('sendmail');

That solved the problem :-))



                Bye
                        Uli
--
_____________________________________________________________________

Uli Zappe               E-Mail: uli@tallowcross.uni-frankfurt.de
                                (NeXTMail,Mime,ASCII) PGP on request
Lorscher Strasse 5      WWW:    -
D-60489 Frankfurt       Fon:    +49 (69) 9784 0007
Germany                 Fax:    +49 (69) 9784 0042

staff member of NEXTTOYOU - the German NEXTSTEP/OPENSTEP magazine 
_____________________________________________________________________


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

Date: Sat, 12 Jul 1997 15:57:41 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: making refs in while() elegantly...
Message-Id: <ED7r05.DA5@world.std.com>

Chris Hostetter <me@anon.com> writes:

>ok, i've just spent 5 hours trying to figure out why:

>    my %res;
>    my @list;
>    while (%res = $result->fetchhash()) {
>	my $hashref = \%res;
>	push @list, $hashref;
>    }

>doesn't work,

Thats a shame. It listed in the perldsc man pages under the heading
"COMMON MISTAKES".

Its suggestion is to use the {} anonymous hash generating operator.

my $hashref = {%res};
push @list, $hashref;

-- 
Andrew Langmead


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

Date: 11 Jul 1997 14:54:58 GMT
From: lvirden@cas.org
Subject: Re: Net::NNTP missing newsgroups?
Message-Id: <5q5hg2$d9g$1@cas.org>


According to Carey Evans  <c.evans@clear.net.nz>:
:Do all the newsgroups have descriptions?  Try:
:
:  $ng = $nh->active("$p_ng");
:
:instead.  (Also, this depends on your news server supporting wildcards
:on LIST ACTIVE, but I guess since you get some, it must do.)

That change seems to solve the problem in the test cases I was using to
verify the report.
-- 
Larry W. Virden                 INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.


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

Date: Fri, 11 Jul 1997 11:01:21 -0700
From: Peter <petergi@synopsys.com>
Subject: Newbie needs help with searching an array
Message-Id: <33C674F1.7713@synopsys.com>

I'm having trouble getting the following to work anf would  appreciate
any help that anyone could give.

I basically have two arrays of user names and want to know if the users
listed in the source array exist in the destination array. What am I
doing wrong?

************* Begin Code:
@sourceUsers 	= ("me", "him", "her", "it");
@destUsers	 = ("her", "it");

foreach $userName (@sourceUsers) {
	if (@destUsers =~ /$userName/) {
		print "$userName already exists in dest\n";
	} else {
		print "$userName does not exist in dest\n";	
	}
}
************* End Code:

My setup: activeware perl 5_003 for NT, NT4sp2

Any help would be GREATLY appreciated. Thanks for listening!


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

Date: Fri, 11 Jul 1997 10:33:36 -0600
From: Mary Jo Brodzik <brodzik@zamboni.colorado.edu>
Subject: Re: no. of days between two dates ?
Message-Id: <33C66060.41C6@zamboni.colorado.edu>

This is a multi-part message in MIME format.

--------------167E2781446B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

*/chebs wrote:
> 
> Hi
> can anyone help me with this one I have been trying to
> calculate the difference in days between two dates in a form
> with out much success.
> 
> all my attempts are way to complicated and I can't work out how to adjust
> for the different no. of days in the months and leap years.
> 
> Any help towards my understanding of this or example code would be great
> thanks
> 
> martin
> @chebs.demon.co.uk

Hi, Martin,

Don't deal with the days per month and leap year problems yourself,
that's really reinventing the wheel :-)

Find a convertor from gregorian (month, day, year) dates to Julian
dates (Julian dates being the number of days since 4713 b.c., sounds
silly, but it's used by astronomers to represent time linearly
rather than according to the whims of a given calendar; the choice
of the reference date is really irrelevant, of course!), then just
do two conversions to Julian date and subtract. 

I'm attaching jdate.pl that a friend of mine gave me, (I think
*he* pulled off the Web someplace!), unfortunately there was no author
information, and all I've done is added the year 2000 problem comment.
I have tested parts of it, but you should do the same to convince
yourself it's doing what you want.

Hope this helps!
Mary Jo

-- 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mary Jo Brodzik
Scientific Programmer/Analyst
National Snow & Ice Data Center
Cooperative Institute for Research in 
Environment Sciences
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

--------------167E2781446B
Content-Type: application/x-perl; name="jdate.pl"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="jdate.pl"

cGFja2FnZSBkYXRlOwoKIyBUaGUgZm9sbG93aW5nIGRlZmluZXMgdGhlIGZpcnN0IGRheSB0
aGF0IHRoZSBHcmVnb3JpYW4gY2FsZW5kYXIgd2FzIHVzZWQKIyBpbiB0aGUgQnJpdGlzaCBF
bXBpcmUgKFNlcCAxNCwgMTc1MikuICBUaGUgcHJldmlvdXMgZGF5IHdhcyBTZXAgMiwgMTc1
MgojIGJ5IHRoZSBKdWxpYW4gQ2FsZW5kYXIuICBUaGUgeWVhciBiZWdhbiBhdCBNYXJjaCAy
NXRoIGJlZm9yZSB0aGlzIGRhdGUuCiMgCiMgTm90ZTogdGhlcmUgbWF5IGJlIGEgcHJvYmxl
bSB3aXRoICJ0b2RheSIgd2hlbiB0aGUgZGF0ZSBpcyBhZnRlciAxOTk5LgojIHRoaXMgc2hv
dWxkIGJlIHRlc3RlZCEhIQojCiMkTG9nOiBqZGF0ZS5wbCx2ICQKIyBSZXZpc2lvbiAxLjIg
IDE5OTcvMDYvMDIgIDE3OjM4OjM1ICBicm9kemlrCiMgV2FybmluZyBjb21tZW50IGFib3V0
IHVzaW5nICJ0b2RheSIgc3Vicm91dGluZSBhZnRlciAxOTk5LgojCiMKCiRicml0X2pkID0g
MjM2MTIyMjsKCnN1YiBtYWluJ2pkYXRlCiMgVXNhZ2U6ICAoJG1vbnRoLCRkYXksJHllYXIs
JHdlZWtkYXkpID0gJmpkYXRlKCRqdWxpYW5fZGF5KQp7Cglsb2NhbCgkamQpID0gQF87Cgls
b2NhbCgkamRhdGVfdG1wKTsKCWxvY2FsKCRtLCRkLCR5LCR3a2RheSk7CgoJd2Fybigid2Fy
bmluZzogIHByZS1kYXRlcyBCcml0aXNoIHVzZSBvZiBHcmVnb3JpYW4gY2FsZW5kYXJcbiIp
CgkJaWYgKCRqZCA8ICRicml0X2pkKTsKCgkkd2tkYXkgPSAoJGpkICsgMSkgJSA3OyAgICAg
ICAjIGNhbGN1bGF0ZSB3ZWVrZGF5ICgwPVN1biw2PVNhdCkKCSRqZGF0ZV90bXAgPSAkamQg
LSAxNzIxMTE5OwoJJHkgPSBpbnQoKDQgKiAkamRhdGVfdG1wIC0gMSkvMTQ2MDk3KTsKCSRq
ZGF0ZV90bXAgPSA0ICogJGpkYXRlX3RtcCAtIDEgLSAxNDYwOTcgKiAkeTsKCSRkID0gaW50
KCRqZGF0ZV90bXAvNCk7CgkkamRhdGVfdG1wID0gaW50KCg0ICogJGQgKyAzKS8xNDYxKTsK
CSRkID0gNCAqICRkICsgMyAtIDE0NjEgKiAkamRhdGVfdG1wOwoJJGQgPSBpbnQoKCRkICsg
NCkvNCk7CgkkbSA9IGludCgoNSAqICRkIC0gMykvMTUzKTsKCSRkID0gNSAqICRkIC0gMyAt
IDE1MyAqICRtOwoJJGQgPSBpbnQoKCRkICsgNSkgLyA1KTsKCSR5ID0gMTAwICogJHkgKyAk
amRhdGVfdG1wOwoJaWYoJG0gPCAxMCkgewoJCSRtICs9IDM7Cgl9IGVsc2UgewoJCSRtIC09
IDk7CgkJKyskeTsKCX0KCSgkbSwgJGQsICR5LCAkd2tkYXkpOwp9CgoKc3ViIG1haW4namRh
eQojIFVzYWdlOiAgJGp1bGlhbl9kYXkgPSAmamRheSgkbW9udGgsJGRheSwkeWVhcikKewoJ
bG9jYWwoJG0sJGQsJHkpID0gQF87Cglsb2NhbCgkeWEsJGMpOwoKCSR5ID0gKGxvY2FsdGlt
ZSh0aW1lKSlbNV0gKyAxOTAwICBpZiAoJHkgZXEgJycpOwoKCWlmICgkbSA+IDIpIHsKCQkk
bSAtPSAzOwoJfSBlbHNlIHsKCQkkbSArPSA5OwoJCS0tJHk7Cgl9CgkkYyA9IGludCgkeS8x
MDApOwoJJHlhID0gJHkgLSAoMTAwICogJGMpOwoJJGpkID0gIGludCgoMTQ2MDk3ICogJGMp
IC8gNCkgKwoJCSAgIGludCgoMTQ2MSAqICR5YSkgLyA0KSArCgkJICAgaW50KCgxNTMgKiAk
bSArIDIpIC8gNSkgKwoJCSAgICRkICsgMTcyMTExOTsKCXdhcm4oIndhcm5pbmc6ICBwcmUt
ZGF0ZXMgQnJpdGlzaCB1c2Ugb2YgR3JlZ29yaWFuIGNhbGVuZGFyXG4iKQoJCWlmICgkamQg
PCAkYnJpdF9qZCk7CgkkamQ7Cn0KCnN1YiBtYWluJ2lzX2pkYXkKewojIFVzYWdlOiAgaWYg
KCZpc19qZGF5KCRudW1iZXIpKSB7IHByaW50ICJ5ZXAgLSBsb29rcyBsaWtlIGEgamRheSI7
IH0KCWxvY2FsKCRpc19qZGF5KSA9IDA7CgkkaXNfamRheSA9IDEgaWYgKCRfWzBdID4gMTcy
MTExOSk7Cn0KCnN1YiBtYWluJ21vbnRobmFtZQojIFVzYWdlOiAgJG1vbnRoX25hbWUgPSAm
bW9udGhuYW1lKCRtb250aF9ubykKewoJbG9jYWwoJG4sJG0pID0gQF87Cglsb2NhbChAbmFt
ZXMpID0gKCdKYW51YXJ5JywnRmVicnVhcnknLCdNYXJjaCcsJ0FwcmlsJywnTWF5JywnSnVu
ZScsCgkgICAgICAgICAgICAgICAgICdKdWx5JywnQXVndXN0JywnU2VwdGVtYmVyJywnT2N0
b2JlcicsJ05vdmVtYmVyJywKCSAgICAgICAgICAgICAgICAgJ0RlY2VtYmVyJyk7CglpZiAo
JG0gbmUgJycpIHsKCQlzdWJzdHIoJG5hbWVzWyRuLTFdLDAsJG0pOwoJfSBlbHNlIHsKCQkk
bmFtZXNbJG4tMV07Cgl9Cn0KCnN1YiBtYWluJ21vbnRobnVtCiMgVXNhZ2U6ICAkbW9udGhf
bnVtYmVyID0gJm1vbnRobnVtKCRtb250aF9uYW1lKQp7Cglsb2NhbCgkbmFtZSkgPSBAXzsK
CWxvY2FsKCVuYW1lcykgPSAoCgkJJ0pBTicsMSwnRkVCJywyLCdNQVInLDMsJ0FQUicsNCwn
TUFZJyw1LCdKVU4nLDYsJ0pVTCcsNywnQVVHJyw4LAoJCSdTRVAnLDksJ09DVCcsMTAsJ05P
VicsMTEsJ0RFQycsMTIpOwoJJG5hbWUgPX4gdHIvYS16L0EtWi87CgkkbmFtZSA9IHN1YnN0
cigkbmFtZSwwLDMpOwoJJG5hbWVzeyRuYW1lfTsKfQoKc3ViIG1haW4nd2Vla2RheQojIFVz
YWdlOiAgJHdlZWtkYXlfbmFtZSA9ICZ3ZWVrZGF5KCR3ZWVrZGF5X251bWJlcikKewoJbG9j
YWwoJHdkKSA9IEBfOwoJKCJTdW4iLCJNb24iLCJUdWUiLCJXZWQiLCJUaHUiLCJGcmkiLCJT
YXQiKVskd2RdOwp9CgpzdWIgbWFpbid0b2RheQojIFVzYWdlOiAgJHRvZGF5X2p1bGlhbl9k
YXkgPSAmdG9kYXkoKQp7Cglsb2NhbChAdG9kYXkpID0gbG9jYWx0aW1lKHRpbWUpOwoJbG9j
YWwoJGQpID0gJHRvZGF5WzNdOwoJbG9jYWwoJG0pID0gJHRvZGF5WzRdOwoJbG9jYWwoJHkp
ID0gJHRvZGF5WzVdOwoJJG0gKz0gMTsKCSR5ICs9IDE5MDA7CgkmbWFpbidqZGF5KCRtLCRk
LCR5KTsKfQoJCnN1YiBtYWluJ3llc3RlcmRheQojIFVzYWdlOiAgJHllc3RlcmRheV9qdWxp
YW5fZGF5ID0gJnllc3RlcmRheSgpCnsKCSZtYWluJ3RvZGF5KCkgLSAxOwp9CgkKc3ViIG1h
aW4ndG9tb3Jyb3cKIyBVc2FnZTogICR0b21vcnJvd19qdWxpYW5fZGF5ID0gJnRvbW9ycm93
KCkKewoJJm1haW4ndG9kYXkoKSArIDE7Cn0KCQoK
--------------167E2781446B--



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

Date: Fri, 11 Jul 1997 08:28:47 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Stephen Hill <buck@huron.net>
Subject: Re: Open File on another server?
Message-Id: <Pine.GSO.3.96.970711082747.10200L-100000@kelly.teleport.com>

On Thu, 10 Jul 1997, Stephen Hill wrote:

> How do you open a file which is on another server?????

I use the server's protocol, often with the help of a module. Hope this
helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 12 Jul 1997 08:32:36 GMT
From: shyde@poboxes.com (Simon Hyde (aka Jeckyll))
Subject: Re: Perl 5.003 -> 5.004_1 migration
Message-Id: <33c740ee.1152806@news.uni-stuttgart.de>

On 9 Jul 1997 13:33:26 -0400, andrew@spyder.manor.org (Andrew Williams) wrote:

@I've looked through this group and have not really seen anything pertaining
@to this. . . . anyway, my question is:
@
@We are running many many perl scripts that use DBM, MSQL, the cgi package, 
@and sybase. (In addtion to a couple of other packages).  Is there anything
@I should watch out for when moving from 5.003 to 5.004_1?  Is this a drop
@in replacement for 5.003?  Will I have to reinstall packages?

There is an option when building perl5.004 to build it with binary compatibility to
perl5.003, this should prevent the need to rebuild any modules


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

Date: Fri, 11 Jul 1997 16:43:47 -0700
From: Will Johnston <will@cs.ucr.edu>
To: Bryan Baars <bbaars@casecorp.com>
Subject: Re: Perl install location
Message-Id: <33C6C533.FBCE5125@cs.ucr.edu>

Bryan Baars wrote:
[Perl install question]
> I would like to take a survey to find out where other people have
> installed it and is it local or NFS mounted.  Any comments about why
> you did it your way would be appreciated.

We do both.  We have one installation of Perl in /usr, mainly due to
the fact that it was included on the image that we made to install our
80 or so Linux machines.  The other installation is in /usr/local,
which is automounted.  We tend to install most of the new/updated
modules that we use in /usr/local because it's easier.  The commonly
run scripts use the local interpreter and the ones that use special
modules run from the shared Perl install.  In the rare case that we
need to update each machine's local installation, we just use a home
grown version of rdist.

It sounds funky, but it works pretty well in practice.  


--
Will Johnston                       Systems Administrator
will@cs.ucr.edu                     Department of Computer Science     
http://www.cs.ucr.edu/~will         University of California, Riverside


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

Date: Fri, 11 Jul 1997 13:14:07 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: Perl is 20 times slower on Cray J90 than SGI!
Message-Id: <33C669DF.35F204C3@hotmail.com>

Brett Denner wrote:
> and the following C program (compiled with "cc prog.c -o prog"):
> 
>   void main()
>   {
>       int i; float a;
>       for (i=0; i <= 1000000; i++)
>           { a = 0; }
>   }

Brett - 

Does your C compiler optimize this away?  (Wouldn't explain why 
Perl's speed differs so btw the two machines, but might explain why
Perl is so much slower than C...)

Scott

-- 
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net


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

Date: Thu, 10 Jul 1997 12:30:45 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: PERL system call
Message-Id: <5863q5.dj4.ln@localhost>

Andrew Williams (aw4@sanger.ac.uk) wrote:
: Please could some one help me!

Sure.

: I am trying to use system to call an external program. This works fine
: but I don't really want to see the output on the screen or pipe it to a
: file as there is a lot of output (approx 1Mb). Therefore I would like to
: send it to null but don't seem to be able to.


die "system() call failed" if system "my_program >/dev/null";


: Please email me if you have any ideas.

Please read the newsgroup where you asked the question...


: Thanks

You're welcome.


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


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

Date: 11 Jul 1997 13:41:03 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: perl w/ mysql - insert?
Message-Id: <5q5d5f$gkt$1@gaia.ns.utk.edu>

Shane (zatezalo.2@osu.edu) wrote:
: 
: I can connect to a database, I can query it, but how in the world do I
: insert data into it using perl?
: 
: use Mysql;
: $dbh = Mysql->Connect($host,$database,$password,$user); 
: $dbh->SelectDB($database);
: 
: # run a simple query
: $sth = $dbh->Query("SELECT name,number FROM phones_table") or die
: $Mysql::db_errstr; 
: 
: while(@record = $sth->FetchRow) { 
:    $name   = $record[0];
:    $number = $record[1];
:    if ($name eq "shane") {
: 	$sth=$dbh->Query("Insert into phones_table (name, number)
: values (\"Shane2\",\"614-xxx-xxxx\"") or die $mysql::db_errstr;
:    }
:    else {
:         print "name=$name number=$number\n";
:    }
: }
: exit;

An insert is not a query. Try:
 $sth=$dbh->do("Insert into phones_table (name, number)
 values (\"Shane2\",\"614-xxx-xxxx\"") or die $mysql::db_errstr;

Jay
-- 
**********************************************
Jay Flaherty                       fty@utk.edu
If software was free, who would pay "THE BILL"
**********************************************


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

Date: Fri, 11 Jul 1997 20:24:17 -0500
From: Brian Clare <bfc@porte.com>
To: zatezalo.2@osu.edu
Subject: Re: perl w/ mysql - insert?
Message-Id: <33C6DCC1.6BE6D39B@porte.com>

Shane wrote:
> 
> I've been using Perl5 w/ mySql - I've read through the FAQ, etc, and
> can't figure this out.
> 
> I can connect to a database, I can query it, but how in the world do I
> insert data into it using perl?
> 
> It'd go something like this (arbitrary sql database w/ employee info
> (name, ph#, etc) in it):
> 
> use Mysql;
> $dbh = Mysql->Connect($host,$database,$password,$user);
> $dbh->SelectDB($database);
> 
> # run a simple query
> $sth = $dbh->Query("SELECT name,number FROM phones_table") or die
> $Mysql::db_errstr;
> 
> while(@record = $sth->FetchRow) {
>    $name   = $record[0];
>    $number = $record[1];
>    if ($name eq "shane") {
>         $sth=$dbh->Query("Insert into phones_table (name, number)
> values (\"Shane2\",\"614-xxx-xxxx\"") or die $mysql::db_errstr;
>    }
>    else {
>         print "name=$name number=$number\n";
>    }
> }
> exit;
> 
> --
> zatezalo.2@osu.edu
> http://www.ecaetc.ohio-state.edu/shane

Why not try something like this...

$sth = $dbh->Query("INSERT INTO phones_table VALUES ('$name',
'$number')");
-- 
Regards...

Brian Clare
Porte Communications


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

Date: Thu, 10 Jul 1997 16:08:30 GMT
From: rich@cheapcalls.com (Rich)
Subject: Problem writing to binary file
Message-Id: <33c506ff.435831313@newsread.cioe.com>

I'm using perl  5 in a DOS window on Windows '95.  The following snippet
illustrates the problem:

open(OUT,">test.out");
for ($i=0;$i<=255;$i++)
 {print OUT chr($i)}

What I'm trying to do (in this trivial example for illustration) is have the
output file read (in HEX):

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
 .etc.

Instead, I'm getting:

00 01 02 03 04 05 06 07 08 09 0A 0D 0B 0C 0D 0E 0F
 .etc.

Everything is fine except when $i == 10 (decimal), which corresponds to the
newline character ("\n") and it gets written to the file as TWO bytes:  OD OA
instead of just 0A (which is what I want her) because in DOS/Windows "\n" gets
translated to a CRLF pair.

How can I prevent this from happening?

All help will be greatly appreciated.


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

Date: Fri, 11 Jul 1997 11:31:06 +0200
From: Jennifer Frank <eedjef@eed.ericsson.se>
Subject: Reading a document in www
Message-Id: <33C5FD5A.167EB0E7@eed.ericsson.se>

I have the problem that I have to look for a documend on a www-server in
a perl programm!
The address is known and I just have to look if it is there ore not (404
error).
Has somebody ever tried something like this?

Jennifer


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

Date: Fri, 11 Jul 1997 08:24:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Dr. Philip Carinhas" <carinhas@gde.GDEsystems.COM>
Subject: Re: Regular experssions and delimiters.
Message-Id: <Pine.GSO.3.96.970711082207.10200K-100000@kelly.teleport.com>

On 10 Jul 1997, Dr. Philip Carinhas wrote:

> $reg_exp = "/$some_other_exp/" ;
> 
> if ($string =~ $reg_exp) .. # Wrong ?

Although that could work (with some cautions), what you probably want is
something like this.

    $reg_exp = 'foo.*bar';	# Or whatever

    if ($string =~ /$reg_exp/o) { ... }

See the perl docs about the /o modifier. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 11 Jul 1997 16:19:56 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: reverse chop?
Message-Id: <5q5mfc$ijm$1@neocad.com>

the count (eglamkowski@mathematica-mpr.com) wrote:
: Is there any trivial way to remove the first character of a string?
: Right now I am using:

: while (<>) {
:   @line = split;
:   print "substr($line[0], 1, length($line[0] - 1))\n";
: }

: but I feel like there should be an easier way... ;-)
: Is there any function like chop that would remove the first
: character, as opposed to the last?

Not one I know of, so write one:

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

$before = 'DDamn those typoes!';
$after = front_chop($before);
print $after;

sub front_chop
{
   my ($string) = (@_);
   my $reversed = reverse $string; 
   chop $reversed;
   my $result = reverse $reversed;
   return $result
}


--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: 11 Jul 1997 15:11:15 -0500
From: roy lewis <royl@netropolis.net>
Subject: Re: reverse chop?
Message-Id: <m2rad5e4d8.fsf@netropolis.net>

Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:

> M.J.T. Guy wrote:
> > 
> > In article <5q19t0$97o$3@info.uah.edu>, Greg Bacon <gbacon@CS.UAH.Edu> wrote:
> > >
> > >In article <33C27DF2.578@mathematica-mpr.com>,
> > >       the count <eglamkowski@mathematica-mpr.com> writes:
> > >: Is there any trivial way to remove the first character of a string?
> > >
> > >$str =~ s/^.//s;
> > 
> > It's almost certainly more efficient to write
> > 
> >    substr($str,0,1) = '';
> > 
> > Regular expressions aren't the solution to _all_ the problems of the universe.
> > 
> 
> actually, it appears that assignment to subtr() is not all that
> efficient ---however, $str=substr($str,1)  is certainly quicker
> according to benchmarking:
> 

why not just 
    $string=unpack "xa*',$string;



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

Date: Fri, 11 Jul 1997 14:49:42 GMT
From: ddurand@hpplus02.cern.ch (Jean-Damien Durand)
To: andrejc@tyr.fe.uni-lj.si
Subject: Re: Sending mails from perl
Message-Id: <ED5t6u.8qr@news.cern.ch>


> Hello!
> 
> I'm writing cgi, that has to send lot's of mails. It is written in perl.
> It does something like:
> 
>         foreach (@maili) {
>                 sendmail($email,$reply,$subject,$body);
>         }
> 
> How could I make this script?
> 
>                                 Andy
> 
> Please send answers to andrejc@tyr.fe.uni-lj.si

  U can have a look to already written scripts, like rjsemail.cgi ( which is
-T's by the way... see the "Cool Modules List" at: 
http://perl.com/perl/info/cool_modules.html )

  Cheers,                    Jean-Damien.
--
       *******************************************************
       *   Jean-Damien Durand (Jean-Damien.Durand@cern.ch)   *
       *         www : http://wwwcn.cern.ch/~ddurand/        *
       *******************************************************


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

Date: Fri, 11 Jul 1997 13:47:04 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
Subject: Sorting Numerically
Message-Id: <Pine.SGI.3.96.970711134139.11990A-100000@davinci.bergen.org>

OK... I am writing a script for my sysadmin:
	It checks the RADLOG to find out how long people have been logged
on via dial-up connection.  Then, it prints out the five people who have
been logged on the most.  It does it by taking those with the highest
number of seconds.  That is then boiled down by doing this:

while ($sec <= 60){
	$sec -= 60;
	$min++;
}
while ($min <= 60){
	$min -= 60;
	$hr++;
}
while ($hr <= 24){
	$hr -= 24;
	$day++;
}

So that it comes out in the form of D days, H hours, M minutes and S
seconds.  HOW do I sort an assoc. array ->

"usernameA", "secondsA",
"usernameB", "secondsB",
 ...

numerically?  I have seen the sort ($a<=>$b) thing, but it doesn't work
for me....  I am a tad clueless.

Thanks for any help.

----------------
| "I don't contemplate it, I just sit and think about it."
| 	- Sonia Balsky
----------------
Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
HTML/CGI Designer and Consultant and JavaScripter
jefpin@bergen.org | TechMasterJeff@juno.com
Got a JavaScript/CGI/Perl question or problem?  Let me know!
webXS - the new eZine for WebProgrammers! webXS@juno.com
Visit us @ http://www.bergen.org/~jefpin/webXS



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

Date: Fri, 11 Jul 1997 23:33:20 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: TechMaster Pinyan <jefpin@bergen.org>
Subject: Re: Sorting Numerically
Message-Id: <33C6B4AF.64977EFE@adc.metrica.co.uk>

TechMaster Pinyan wrote:

> OK... I am writing a script for my sysadmin:
>         It checks the RADLOG to find out how long people have been
> logged
> on via dial-up connection.  Then, it prints out the five people who
> have
> been logged on the most.  It does it by taking those with the highest
> number of seconds.  That is then boiled down by doing this:
>
> while ($sec <= 60){
>         $sec -= 60;
>         $min++;
> }
> while ($min <= 60){
>         $min -= 60;
>         $hr++;
> }
> while ($hr <= 24){
>         $hr -= 24;
>         $day++;
> }
>
> So that it comes out in the form of D days, H hours, M minutes and S
> seconds.  HOW do I sort an assoc. array ->
>
> "usernameA", "secondsA",
> "usernameB", "secondsB",
> ...
>
> numerically?  I have seen the sort ($a<=>$b) thing, but it doesn't
> work
> for me....  I am a tad clueless.
>
> Thanks for any help.
>
> ----------------
> | "I don't contemplate it, I just sit and think about it."
> |       - Sonia Balsky
> ----------------
> Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
> HTML/CGI Designer and Consultant and JavaScripter
> jefpin@bergen.org | TechMasterJeff@juno.com
> Got a JavaScript/CGI/Perl question or problem?  Let me know!
> webXS - the new eZine for WebProgrammers! webXS@juno.com
> Visit us @ http://www.bergen.org/~jefpin/webXS

   See the perl FAQ at www.perl.com it has an entry on sorting
associative arrays by key or value.

Simon



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

Date: Fri, 11 Jul 1997 08:52:06 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Simon Fairey <sfairey@adc.metrica.co.uk>
Subject: Re: Speed differences when passing array to function by ref!
Message-Id: <Pine.GSO.3.96.970711084232.10200P-100000@kelly.teleport.com>

On Fri, 11 Jul 1997, Simon Fairey wrote:

> use Benchmark;
> 
> my @big_array = ( 0 .. 100000 );

 ...

> timethese(shift, {
>         'using value' => '&valuefunc( @big_array );',
>         'using ref  ' => '&reffunc( \@big_array );',
> });

It can be surprising, but timethese is actually using an eval(STRING) to
do the code you specify. Since @big_array is a my variable, the code in
the strings can't access it. Try making it a global, and you'll see what
you would expect.

Of course, you could make it a my variable that is defined within the
string, among other ways of making this work. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: 11 Jul 1997 14:21:47 -0400
From: dyarbrou@clark.net (Danny Yarbrough)
Subject: Strategies for dealing with the 'Use of uninitialized value' warning.
Message-Id: <slcbu49v490.fsf@clark.net>


Hi.

I'm curious to see how perl folks out there deal with the somewhat
vague perl warning:

Use of uninitialized value at myscript line xxx

First off, is there a logical reason why it doesn't tell you what
value (or variable) is undefined?

In a script where line xxx may contain serveral variable referances,
it can be a bit tricky to narrow down which one is the offending one.
I know about initializing all variables before they are used, of
course, but sometimes that doesn't always work, especially if some
routine or other has returned an undefined variable.

I've gone so far as to rewrite the line in question as multiple lines,
each using only one or two of the variables; this isn't always
practical.

So, anyone have any thoughts?

Thanks for your suggestions,

Danny
(dyarbrou@clark.net)




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

Date: Fri, 11 Jul 1997 18:24:41 GMT
From: over@the.net (view archives)
Subject: Re: Strategies for dealing with the 'Use of uninitialized value' warning.
Message-Id: <33c679b7.5910204@news.one.net>

dyarbrou@clark.net (Danny Yarbrough) wrote:

>
>Hi.
>
>I'm curious to see how perl folks out there deal with the somewhat
>vague perl warning:
>
>Use of uninitialized value at myscript line xxx
>

You didn't really mean to ask this did you?


Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: Sat, 12 Jul 1997 02:09:52 GMT
From: FANNGMAIL@prodigy.net (Fan Ng)
Subject: tr.problem
Message-Id: <33cce76f.34215056@news.prodigy.net>

Hi all:
 I had seem a example in book whick is
 tr[\200-\377]
   [\000-\177];  #delete 8th bit     

I don't know that delete 8th bit means and why in the [ ] need \ in front of
number?? Thank you
fanng@prdigy.net


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

Date: 11 Jul 1997 16:09:39 GMT
From: "mashfiel" <ashfield.matthew@miti.nb.ca>
Subject: Tracking running time??
Message-Id: <01bc8d4b$1f0c61a0$3e080a0a@mashfiel.miti.nb.ca>

Not sure if this is a Perl question or not, if not, please just ignore it.
I was just wondering if there's a way to track the running time of a Perl
program. I am comparing the running times of two similar programs, and want
to see which is faster and by how much. 
Anyways, like I say if this is not a Perl issure, and more of a platform
issue (ie.Unix, NT, etc..) my apologies.

Thanks for your time,
Matt
ashfield.matthew@miti.nb.ca


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

Date: 11 Jul 1997 17:50:38 -0600
From: rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray)
Subject: Re: use //require
Message-Id: <uowwwmxi1wx.fsf@tremere.ecte.uswc.uswest.com>

>>>>> "Nicolas" == Nicolas Gregoire <Joelle>
>>>>> wrote the following on Thu, 10 Jul 1997 14:37:37 +0200

  Nicolas> What's the difference between use '/users/,,,/lib.pm

  Nicolas> and

  Nicolas>  require '/users/,,,/lib.pm.

The "use" keyword occurs at compile-time, and also effects a call into a
method "import" expected to be within the file's namespace (that is, if the
file is Mod.pm, it is expected to define a Mod::import() which will be called
if the load of the file succeeds). The "require" keyword happens at run-time,
and does not try to call import.

use Config;

is equivalent to:

BEGIN { require 'Config.pm'; import Config }

Randy
-- 
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS         Phone: (303)595-2869
                Denver, CO                                     rjray@uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin


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

Date: 12 Jul 1997 05:12:35 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Using .forward file to start a perl script
Message-Id: <5q73o3$hjl@fridge-nf0.shore.net>

Lee Mahan (lee@no.spam-designwest.com) wrote:
: I'm looking at creating a filter for majordomo.  What we want to do is
: automatically filter out and unsubscribe those persons who's address is
: no longer valid.

Someone posted an answer to a question like yours about a week ago.
Basically, you write a script that reads STDIN and does something with
the data.

In your .forward, put: |scriptname args your_username

Your script:

@lines = <STDIN>;

Now do something with the lines.

I'd suggest using the Mail modules to help out with the parsing.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 11 Jul 1997 10:09:35 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Want benefit of 'my' variables in a package
Message-Id: <5q50ov$fvb@lyra.csx.cam.ac.uk>

Brett Denner  <Brett.W.Denner@lmtas.lmco.com> wrote:
>
>Is there a way to get the benefits of "use strict 'vars'" yet have my
>variables go into the current package?

Two ways:

i)    Always use qualified names, i.e. $mypackage::myvar or $main::mainvar
      or $::mainvar.

ii)   If you refer to a variable frequently, this qualifying may become
      tedious.   You can instead declare the variable with

          use vars qw( $myscalar %myhash );

      which prevents both the "use strict;" complaint and also the -w
      complaint "variable used once".


Mike Guy


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

Date: Fri, 11 Jul 1997 16:41:03 -0700
From: Austin Schutz <tex@collegenet.com>
Subject: Re: What is Perl syntax for SELECT CASE?
Message-Id: <33C6C48F.79EF@collegenet.com>

Tad McClellan wrote:
> 
> Jeff Motter (jmotter@fgi.net) wrote:
> : Is there an equivalent (Perl 5 under Win NT) for Basic's "SELECT CASE", or
> : C++'s "SWITCH"?  Or do I use a bunch of "IF" statements?
> 
> You search for 'switch' in the Perl FAQ:
> 
> "How do I create a switch or case statement?"

	I've never been satisfied with anything I've seen written about this.
Here's what works for me, and it's what I recommend for use with 
my (shameless plug) Expect module:

$_=$variable_to_test;
{
  !(defined($_)) && do {
     variable_is_undef();
     last;
  };

# The point of using $_ is for brevity but also in case you prefer
# doing /^0$/ instead of $==0. Much easier for regexp matching.

  $_==0 && do { # this could be eq '' for strings.
    variable_is_zero();
    last;
  };
  $_==1 && do {
    .....
  };
   # default $_ hasn't matched anything.
  variable_didnt_match();
}

> Please don't be so rude again.
> 

  I think there needs to be a little more Zen on Usenet :-).


	Tex


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

Date: Sat, 12 Jul 1997 02:09:48 GMT
From: FANNGMAIL@prodigy.net (Fan Ng)
Subject: what's going on here??
Message-Id: <33cbe674.33963912@news.prodigy.net>

Hi all:

I saw this in a book and I realy don't what's this means?
who can explain to me, thank you.
$/ = " ";      
while ($paragraph=<>)     #Here I can't see any relate with first line.
{ while ($paragraph =~ /[a-z] [' ")] * [.!?] + [' " )] * \s/g)  {             
$sevtences++;
   }
}
print "$sentences\n";

fanng@prodigy.net


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

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

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