[8141] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1759 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 29 07:07:18 1998

Date: Thu, 29 Jan 98 04:00:29 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 Jan 1998     Volume: 8 Number: 1759

Today's topics:
    Re: -dates in perl- <xxTony.Curtis@vcpc.univie.ac.at>
    Re: -dates in perl- <joseph@5sigma.com>
    Re: cgi file saving problem... <rootbeer@teleport.com>
    Re: check URL <rootbeer@teleport.com>
    Re: Check Variable type <rootbeer@teleport.com>
    Re: Check Variable type <rootbeer@teleport.com>
        Error Msg 'Data Missing' <abergmann@mailexcite.com>
    Re: Error Msg 'Data Missing' <joseph@5sigma.com>
    Re: Error(?) messages from perldoc <rootbeer@teleport.com>
    Re: help needed with varaible in a pattern <rootbeer@teleport.com>
    Re: Help with SORT (Jim Michael)
    Re: Internet Community needs cgi scripts <spt@cstr.ed.ac.uk>
    Re: IP Address as new File <rootbeer@teleport.com>
        re: kerchop <rootbeer@teleport.com>
    Re: Multiple copies of the same option on command line (Johan Vromans)
    Re: multiple single line match <rootbeer@teleport.com>
    Re: My function call doesn't seem to work sometimes <rootbeer@teleport.com>
        OLE doesn't work <mike@inforis.ru>
        open in append mode <ccordero@wiley.csusb.edu>
    Re: Perl CGI real-time database application <rootbeer@teleport.com>
    Re: perl4, solaris, varargs <rootbeer@teleport.com>
    Re: Problem with self-installing script <rootbeer@teleport.com>
    Re: Problem with typeglob <rootbeer@teleport.com>
    Re: Regular expression help.... <joseph@5sigma.com>
        Searching the Perl docs (Was: Re: Survival Of perl) <rootbeer@teleport.com>
    Re: Site map for web site - Perl scripts - help please <rootbeer@teleport.com>
    Re: size limit to the length of a perl script (Victor Pronk)
    Re: Some Questions Regarding Error Messages Generated b <joseph@5sigma.com>
    Re: Some Questions Regarding Error Messages Generated b <rootbeer@teleport.com>
    Re: Split <joseph@5sigma.com>
    Re: Strange behaviour of chomp AIX vs. Linux? <rootbeer@teleport.com>
    Re: Strip Trailing Spaces. How? <rootbeer@teleport.com>
    Re: Survival Of perl <spt@cstr.ed.ac.uk>
    Re: Use of Signals <rootbeer@teleport.com>
    Re: Want to determine the subnet networks from a networ <rootbeer@teleport.com>
    Re: Want to determine the subnet networks from a networ (Francois Trousset)
    Re: Why can't I unzip? (Jim Michael)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 29 Jan 1998 10:56:34 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: James@cydaps.co.uk
Subject: Re: -dates in perl-
Message-Id: <7x67n37gdp.fsf@beavis.vcpc.univie.ac.at>

Re: -dates in perl-, James <James@cydaps.co.uk> said:

James> I have managed to get a perl script to detect the
James> date in a textfile (written in seconds for ease
James> instead of a normal format such as 31/01/98) and if

James> regarding our services, but what I want to be able to
James> do is to place a line of text saying that their
James> registration is due to expire on the
James> ....... (whatever date) in a clear format, not in
James> seconds!

Modules!

  Date::DateCalc
  Date::Manip

either or both of these probably do what you want, or at
least will provide a framework.

hth,
tony



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

Date: Thu, 29 Jan 1998 03:01:50 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: -dates in perl-
Message-Id: <34D05330.6B2619DC@5sigma.com>

There are a ton of time and date related modules in the CPAN.
http://www.perl.com/CPAN/.

Good luck!

	-joseph

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Thu, 29 Jan 1998 03:10:04 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Quasimodo <mahubbar@mail.vt.edu>
Subject: Re: cgi file saving problem...
Message-Id: <Pine.GSO.3.96.980129030301.27354s-100000@user2.teleport.com>

On Thu, 29 Jan 1998, Quasimodo wrote:

> I'm very new to Perl, and to CGI in general, 

What an odd thing to say! It's a little like saying, "I'm very new to
driving, and to hamburgers in general". But perhaps that statement may
seem more sensible to you if you use your car for nothing other than going
to the drive-up window.  :-) 

> but I wrote a little script that takes the data from a form, parses it,
> and is then supposed to give it HTML headers and save it to an html
> file.  I can view the $string outputted, and it all works correctly, but
> it spits out errors when it gets to the file saving part. 

Do the error messages give you any helpful information? It would help us
to help you if you were to include them, of course. 

> $unique = charname;

Is that a function call? Or a string? Although Perl will let you get away
with using a bareword as a string, it's generally a bad idea. 

> open (DUMMY, ">$char_file");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

> print DUMMY $message; 
> close (DUMMY);
> 
> unlink($char_file);

Hmmm... Did you just unlink the file you just created? Why would you want
to do that?

Hope this helps!

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



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

Date: Thu, 29 Jan 1998 02:21:42 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Abigail <abigail@fnx.com>
Subject: Re: check URL
Message-Id: <Pine.GSO.3.96.980129021758.27354i-100000@user2.teleport.com>

On 28 Jan 1998, Abigail wrote:

> Tom Phoenix (rootbeer@teleport.com) wrote on 1611 September 1993 in

That was a Tuesday, I think. :-)

> <URL: news:Pine.GSO.3.96.980127214536.13242O-100000@user1.teleport.com>:
> ++ On 27 Jan 1998, Wei Weng wrote:
> ++ 
> ++ > Is there anyway to use perl to test a URL is valid or not? 
> ++ 
> ++ Use the LWP module. Hope this helps!

> LWP will tell you if email addresses are valid?

I believe that the original poster wanted to test to see whether a
particular HTTP URL can be used to retrieve information. As you noted, I
made some assumptions about what he meant, but I don't think they were
unjustified assumptions. Cheers!

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



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

Date: Thu, 29 Jan 1998 02:04:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Real <real@earthling.net>
Subject: Re: Check Variable type
Message-Id: <Pine.GSO.3.96.980129020342.27354f-100000@user2.teleport.com>

On 28 Jan 1998, Real wrote:

> print "Number: "; $number = <STDIN>; chomp($number);
> $chknum = $number; $chknum =~ s/[0-9]//g;
> if ($chknum eq '') { print "Nummeric\n" } else { print "Alpha-nummeric\n";
> }

So, 3.14159 isn't a number but the empty string is?

Of course, the question was a FAQ.

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



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

Date: Thu, 29 Jan 1998 02:07:02 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jeff Stampes <stampes@xilinx.com>
Subject: Re: Check Variable type
Message-Id: <Pine.GSO.3.96.980129020539.27354g-100000@user2.teleport.com>

On 28 Jan 1998, Jeff Stampes wrote:

> If it matches a non-digit, it's not an integer

I tend to think that -3 is an integer, although it's a difficult number
of beers to buy. :-)  But +3 is also a good integer, don't you think?

Of course, the original question was a FAQ.

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



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

Date: Thu, 29 Jan 1998 10:28:50 +0100
From: andreas bergmann <abergmann@mailexcite.com>
Subject: Error Msg 'Data Missing'
Message-Id: <34D04BD1.C8F832B5@mailexcite.com>

 I wrote a Perl program and get sometimes the following error message
when starting the program in a Netscape Browser.

'Data Missing

This document resulted from a POST operation
and has expired from the cache. If you wish you
can repost the form data to recreate the document
by pressing the reload button.
'

The error occurs only occasionally. I could not detect a
regularity.
What can I do to prevent the error?

andreas
abergmann@mailexcite.com




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

Date: Thu, 29 Jan 1998 02:47:39 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Error Msg 'Data Missing'
Message-Id: <34D04FDE.416C6960@5sigma.com>

For a start, you could post this question on a CGI programming
newsgroup.

	-joseph

andreas bergmann wrote:

> The error occurs only occasionally. I could not detect a
> regularity.
> What can I do to prevent the error?
> 
> andreas
> abergmann@mailexcite.com

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Thu, 29 Jan 1998 00:54:30 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Allan Krause <allank@techone.com.au>
Subject: Re: Error(?) messages from perldoc
Message-Id: <Pine.GSO.3.96.980129005130.27354S-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Allan Krause wrote:

> perldoc appears to be having a bit of a problem seeing some files (see
> below) before it actually displays the good stuff???  Is there any way
> to avoid these error/warning/informative messages? 
> 
> perldoc -f open
> Ignored c:\perl\lib\site/perlfunc.pod: unreadable
> Ignored c:\perl\lib\site/perlfunc.pm: unreadable
> Ignored c:\perl\lib\site/perlfunc: unreadable

Those look like signs that your copy of Perl (or perldoc, or the docs) is
misinstalled. But you could always patch perldoc to do something other
than warn about this, if that's what you want. Or you may be able to
redirect the errors to your machine's equivalent of /dev/null. Hope this
helps!

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



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

Date: Thu, 29 Jan 1998 02:38:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Sylvain Juneau <sjuneau@microtec.net>
Subject: Re: help needed with varaible in a pattern
Message-Id: <Pine.GSO.3.96.980129023334.27354k-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Sylvain Juneau wrote:

> The patytern matching does not work.   if(/^$d/)

That should work if the resulting pattern is valid.

>  $d="$client_prod_list[$b]";

Of course, the quote marks are superfluous. But is that array element
valid to use in that regular expression? (If you wish merely to see
whether the string in $_ begins with that same string, perhaps you should
use substr or index instead.) 

It would be easier to read and maintain your code if you use good
indentation; a programmers' editor should be able to help you to do
that. 

Hope this helps!

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



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

Date: Thu, 29 Jan 1998 11:33:47 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Help with SORT
Message-Id: <genepoolEnJMsB.73G@netcom.com>

Joseph N. Hall (joseph@5sigma.com) wrote:
: First, note that as numbers, 1.1 and 1.10 are the same thing.

Since the example given had 1.10 following 1.2 in the result, I think a 
hierarchical ordering is required.

Cheers,

Jim


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

Date: 29 Jan 1998 11:04:39 +0000
From: Richard Caley <spt@cstr.ed.ac.uk>
Subject: Re: Internet Community needs cgi scripts
Message-Id: <eyhlnvz4k3c.fsf@liddell.cstr.ed.ac.uk>

In article <6al1l2$8rp@bgtnsc03.worldnet.att.net>, John Paulson (jp) writes:

jp> We will exchange Free Web space, 1 POP E-mail account and
jp> recognition for the program and programming.

Let's see. The email address is worth nothing (can pick those up for
nothing). 

A reasonable CGI script, say half a day's work, say 150-200 quid. 2-3GB
of web sapce at current disk prices? 

If they're not demaning remmuneration at that rate are you really
going to run the resulting scripts on your machine? Shudder.

-- 
Mail me as rjc not spt@cstr.ed.ac.uk		_O_
						 |<



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

Date: Thu, 29 Jan 1998 00:43:23 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: IP Address as new File
Message-Id: <Pine.GSO.3.96.980129003812.27354Q-100000@user2.teleport.com>

On Tue, 27 Jan 1998, Chipmunk wrote:

> Tom Phoenix wrote:
> > 
> > On Tue, 27 Jan 1998, Tad McClellan wrote:
> > 
> > > Derek Blandford (blan0416@uidaho.edu) wrote:
> > > : And you do not use parenthesis when printing to the file....
> > > :
> > > : Jason Hansen wrote:
> > > : > print TEMP_FILE ("$remote_address|$url\n");
> > 
> > > Well, you _can_ use parenthesis when printing if you want to.
> > > Of course, you need to do it correctly  ;-)
> > >    print(TEMP_FILE "$remote_address|$url\n");
> > 
> > Not that that is any more correct than what Jason Hansen had 
> > written, of course. :-)
>
> In fact, I'd say it's *less* correct, as it will result in a warning
> message with -w. 

What warning message would that be? I don't get one with this code running
under 5.004_04:

    #!/usr/bin/perl -w

    use strict;

    my $remote_address = 'some-remote-address';
    my $url = 'some-URL';

    open TEMP_FILE, ">&STDOUT" or die "Can't dup STDOUT: $!";
    print TEMP_FILE ("$remote_address|$url\n");		# Jason's
    print(TEMP_FILE "$remote_address|$url\n");		# Tad's

Did earlier versions of Perl warn about something here?

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



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

Date: Thu, 29 Jan 1998 00:34:25 -0800
From: Tom Phoenix <rootbeer@teleport.com>
Subject: re: kerchop
Message-Id: <Pine.GSO.3.96.980129003013.27354P-100000@user2.teleport.com>

On Wed, 28 Jan 1998, it was written:

> ... So far I've been trying to use the SPLIT funtion to break up a
> large file at 'separators' that occur many lines apart. Does anyone
> know if SPLIT can do this or is it restricted to breaking things apart
> one line at a time where the separator occurs one or more times per
> line ?

split can do this, although I'm not completely certain that it is the
right tool for the job. (I'd consider setting $/ to a string representing
the separator you want, as one possibility.) Good luck with it! 

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



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

Date: 29 Jan 1998 09:47:08 +0100
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Re: Multiple copies of the same option on command line
Message-Id: <wl3afcfbrar.fsf@plume.nl.compuware.com>

epa@datcon.co.uk (Ed Avis) writes:

> I'm using Getopt::std to parse command line options.  The only problem
> is with options that may be specified more than once, for example the
> -e option which specifies a "variable" and its value to my program
> (which is a preprocessor).
> 
> For example
> 
> perl jpp.pl -e var1=value1 -e var2=value2 files...
> 
> Perhaps the solution is to move to Getopt::long, but I don't really
> understand how to use that module.

  use Getopt::Long;
  my %vars = ();
  Getopt::Long::config("bundling");
  GetOptions ('e=s' => \%vars);

Explanation: when a string-valued option is bound to a variable, the
value will be stored in that variable.

When bound to an array, values will be pushed into that array.

When bound to a hash, it will take values of the form aaa=bbb that are
put into the hash as key/value pairs.

(The bundling config is only required if you have other single-letter
options as well that may be bundled, e.g. -abc meaning -a -b -c.)

Hope this helps.

-- Johan


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

Date: Thu, 29 Jan 1998 01:58:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: peter@uhu.com
Subject: Re: multiple single line match
Message-Id: <Pine.GSO.3.96.980129015705.27354e-100000@user2.teleport.com>

On Wed, 28 Jan 1998 peter@uhu.com wrote:

> I have a comma delimeted text database. Each value in the "field" is
> enclosed in '"' double quotes. 

> 1.) I have to "fish" out all products, and their respective platforms
> whose status is xyz. 

Maybe you want one of the several modules which can handle CSV data. 
(Although that's not what you asked.) Hope this helps!

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



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

Date: Thu, 29 Jan 1998 01:08:26 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Suravarapu Bhanu P <bps8527@usl.edu>
Subject: Re: My function call doesn't seem to work sometimes
Message-Id: <Pine.GSO.3.96.980129010002.27354T-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Suravarapu Bhanu P wrote:

> I am using perl5.003. I have a function call in a certain script.
> My problem is that this function is executed only sometimes. I realized
> this by placing some debug statements. The details are below.
> 
> I have the following code (which gives me the problem)
> Below assume that @TravNodes contains the numbers 2,6,7,8,9,10 and 11
> 
> while ($node)

What's in $node?

> { 
>    open(FILE1,">>file1.txt");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

>    print FILE1 "\n".$node." - before travlink".$url;

Generally, it's better to put the newline at the end of the print
statement. And double-quote interpolation can make this clearer. Maybe you
could use something like this: 

    print FILE1 "Node $node - before travlink - $url\n";

>    $response = &travlink($node);
> 
>    print FILE1 "\n".$node." - ".$response." - after travlink".$url;
> }
> continue
> {
>    $node   = shift(@TravNodes);
> }

This kind of a while loop is usually better written something like this:

    while (@TravNodes) {
	my $node = shift @TravNodes;
	...
    }

(This is more idiomatic, simpler to enter, and less likely to have
problems. If a value of the list might be undef, the empty string, or
zero, the other loop might exit early.)

> The entries from the print statement in the travlink function for
> $node values - 6,8 and 10 are missing

Maybe the open function failed to open the file, or maybe more than one
connection was open to the file at the same time. Or, taking another
approach, perhaps @TravNodes is being accessed elsewhere in your code; you
could try making it a my() variable and see what breaks. :-)  Hope this
helps! 

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



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

Date: Thu, 29 Jan 1998 12:33:31 +0300
From: "Michael Sazonov" <mike@inforis.ru>
Subject: OLE doesn't work
Message-Id: <6apiit$lqj@xpress.inforis.nnov.su>

Hi All!

I first time tried to work with OLE in Perl for Win32
by ActiveWare.

When I try to run script excel1.pl in Perl/Eg, Perl
writes the following:

Can't call method "Add" without a package or object
reference at excel1.pl line 24.

Why? My OS is Windows NT 4.0 WKS. MS Office 95 is
installed.

Help me, please.

---
Michael Sazonov, mike@inforis.ru





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

Date: Wed, 28 Jan 1998 11:21:20 -0800
From: Chad R Cordero <ccordero@wiley.csusb.edu>
Subject: open in append mode
Message-Id: <34CF8530.41C67EA6@wiley.csusb.edu>

For some reason I can't figure out how to append text to a file.  I
originally tried the following:

	open(FILE, ">>file");
		print FILE ("$variable");
	close(FILE);

but that failed.  I have gone through all of the books in my office to
find an example for open in append mode but cannot find one.  What am I
doing wrong?  How should I do this?

Any help is appreciated.

Chad Cordero


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

Date: Thu, 29 Jan 1998 02:51:23 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Sarah.Kamal@cgy.valmet.com
Subject: Re: Perl CGI real-time database application
Message-Id: <Pine.GSO.3.96.980129024839.27354p-100000@user2.teleport.com>

On Wed, 28 Jan 1998 Sarah.Kamal@cgy.valmet.com wrote:

> I'm not sure if the application that I need to create is even possible. 

Well, if you really need to create it, I hope it's possible! :-)

> The application has to display data from a UNIX server on a PC.

I've seen applications that do that. :-)

> I was thinking that I would write a perl cgi script for this and display
> with an html page of tables. 

Perhaps you could.

> The real problem is that the data on the page has to update continuously
> while the page is open and I'm not sure how a cgi script can run
> continuously. 

Well, if you can't find the answer in the docs about CGI scripts, the
people in a newsgroup about CGI scripts should be able to help. Of course,
there's nothing Perl-specific about that part of what you're doing, so
people in another newsgroup may be able to give you better and
more-complete answers. Good luck! 

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



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

Date: Thu, 29 Jan 1998 00:29:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Brendan Macmillan <bren@fangorn.cs.monash.edu.au>
Subject: Re: perl4, solaris, varargs
Message-Id: <Pine.GSO.3.96.980129002521.27354O-100000@user2.teleport.com>

On 28 Jan 1998, Brendan Macmillan wrote:

> *sigh* this is the typical response to any perl4 question. 

[Please understand that I mean this sincerely, without any sarcasm.]

Perhaps you have a better response than the one I gave. If so, I strongly
encourage you to offer it. 

If you would like to support old versions of Perl, please be my guest.

When people have questions about using Perl version 4, may we send them to
you?

Cheers!

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



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

Date: Thu, 29 Jan 1998 01:55:52 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Kevin Miles <kmiles@erols.com>
Subject: Re: Problem with self-installing script
Message-Id: <Pine.GSO.3.96.980129015428.27354d-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Kevin Miles wrote:

> The file is being created ok and I can chmod it ok, but I can't seem to
> get it to execute. 

>         chmod 0111, 'setup.pl';

That doesn't look right. Hope this helps!

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



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

Date: Thu, 29 Jan 1998 02:40:58 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Gene Johannsen <gej@spamalot.mfg.sgi.com>
Subject: Re: Problem with typeglob
Message-Id: <Pine.GSO.3.96.980129023939.27354l-100000@user2.teleport.com>

On 28 Jan 1998, Gene Johannsen wrote:

>     (W) Typographical errors often show up as unique variable names.
>     If you had a good reason for having a unique name, then just mention
>     it again somehow to suppress the message.  The use vars pragma is
>     provided for just this purpose.
> 
> 
> How do I use a typeglob in this case without getting the Typographical
> error warning and without using `use vars (..)`?

If you had a good reason for having a unique name, then just mention it
again somehow to suppress the message. :-)

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



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

Date: Thu, 29 Jan 1998 02:53:13 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Regular expression help....
Message-Id: <34D0512B.A1C56@5sigma.com>

Hmm,

	perl -pi.bak -e 's/\d{10}/1234567890/' thefilename

Steel Viper wrote:
> 
> All I am trying to do is find the first 10 digit number that I
> come to while reading a file, and then I want to replace it with
> whatever number I desire.

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Thu, 29 Jan 1998 02:26:02 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Searching the Perl docs (Was: Re: Survival Of perl)
Message-Id: <Pine.GSO.3.96.980129022231.27354j-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Dave Barnett wrote:

> Do I use perldoc -f function?  Do I use perldoc module name?  Which one
> of the 9 perlfaq's should I start with?
> 
> I'm more than willing to read something that makes sense and answers my
> question(s), but I find it terribly difficult sometimes to find what I
> need in the FAQ.  Maybe this is just me, but there was a recent post
> regarding the same type of thing.  There has to be a better way, but I'm
> not sure what it is.  An SQL type interface maybe?  or some other means
> to 'easily' locate a relevant topic? 

The perltoc manpage may be of some help. If you find a topic covered by
the docs which isn't easy to find in perltoc, please submit a doc patch. 

Of course, that's not to say that some other way to find the information
couldn't be useful. 

Thanks! 

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



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

Date: Thu, 29 Jan 1998 01:48:02 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Geoff Wilkins <GeoffW@wordsmith.demon.co.uk>
Subject: Re: Site map for web site - Perl scripts - help please
Message-Id: <Pine.GSO.3.96.980129014631.27354a-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Geoff Wilkins wrote:

> Could anyone advise me where I might find any ready-made Perl scripts
> that would assist me in this (or perhaps some other free or cheap
> software)?

    http://www.yahoo.com/Computers_and_Internet/Software/Archives/

Of course, there's nothing Perl-specific about free or cheap software...
:-)

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



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

Date: Thu, 29 Jan 1998 08:55:35 GMT
From: victor@ddsgouda.com (Victor Pronk)
Subject: Re: size limit to the length of a perl script
Message-Id: <34d0439d.3271914@news.utwente.nl>

On Wed, 28 Jan 1998 12:11:52 -0600, cotal@delphi.com wrote:

>Is there a size limit to the length of a perl script running as a cgi?
>
>My script is about 1500 lines, across 3 different files.
>
>It fails to run if I add another line or another subroutine.
If you're working in Notepad, the problem could be there. I had the
same problem and it was Notepad that would not save anymore lines.

Victor


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

Date: Thu, 29 Jan 1998 03:13:49 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Some Questions Regarding Error Messages Generated by the -w switch
Message-Id: <34D055FF.9B386569@5sigma.com>

See my debugging chapter online underneath:

  http://www.effectiveperl.com/toc.html

See the part where it says if you're going to use -w, use it
from the very beginning?  Of course, you didn't know at first, but
you know now.  :-(

It may be a while before you produce a complaint-free script.
It's probably worth the suffering.  You can 'use diagnostics' to
make the path a little clearer.

	-joseph

p.s.  Buy some newer Perl books.  Remember that movie "Jurassic Perl?"
That was 1992.  Buy a blue Camel, and definitely consider buying a Shiny Ball book!

V. Chandrasekhar wrote:
> 
> 1. I have been working on a Perl program for about two weeks now.
> (It is about 1000 lines long - the 'main' is about 100 lines long;
> the rest are all subroutines.)
> 
> 2. I did not start using the -w switch. Recently, I started using
> this switch. I am surprised by some of the error/warning messages
> that I am getting. [...]

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Thu, 29 Jan 1998 02:47:23 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "V. Chandrasekhar" <vchandra@mail.delcoelect.com>
Subject: Re: Some Questions Regarding Error Messages Generated by the -w switch
Message-Id: <Pine.GSO.3.96.980129024524.27354o-100000@user2.teleport.com>

On Wed, 28 Jan 1998, V. Chandrasekhar wrote:

> I have the 1992 version of the Camel book. This is my main resource. I
> am aware of perlfaq1 to perlfaq9 - I should get into the habit of
> spending more time with them. (By the way, do people use these online
> mostly or do they print them out and use as a printed reference ?

I think online, mostly. If people want a printout, they'll generally buy
the new Camel. A good idea, BTW. Hope this helps!

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



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

Date: Thu, 29 Jan 1998 02:59:18 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Split
Message-Id: <34D05298.275FE05F@5sigma.com>

Perhaps:

  undef $/;
  print join "\n", <DATA> =~ /((?:\S+\s+){5})/g;
  __END__
  this is some data here are some words this is some more data here are
  some more words

Moshe Aaron Allen wrote:
> 
> Hi,
>  I'm need to split() a pararaph after every five words. Can anyone help?
> 
> MA

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Thu, 29 Jan 1998 01:43:43 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Wouter Liefting <see_text_for_email@nospam.please.com>
Subject: Re: Strange behaviour of chomp AIX vs. Linux?
Message-Id: <Pine.GSO.3.96.980129012612.27354W-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Wouter Liefting wrote:

> From: Wouter Liefting <see_text_for_email@nospam.please.com>

And then later:

> If you prefer email do it to liefting@nl.ibm.com

Spammers read the email addresses in the body of the text, too. You're
inconveniencing the people you're asking for help, but to no purpose. :-(

> I wrote some CGI-scripts in perl which uses chomp to strip off the
> trailing newline. But somehow this does not work (correctly) under AIX.

If your copy of perl for AIX is correctly compiled, you may have found a
bug. But did your perl pass all of the tests from 'make test'? That
includes a check that chomp is working correctly. 

If you can make a small test program (say, ten lines) which shows the
problem behavior, please post it. Thanks!

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



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

Date: Thu, 29 Jan 1998 01:49:17 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dzuy Nguyen <dzuy@dazel.com>
Subject: Re: Strip Trailing Spaces. How?
Message-Id: <Pine.GSO.3.96.980129014852.27354b-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Dzuy Nguyen wrote:

> while (($c = chop($string)) eq " ") {
> ...
> }

That's generally a bad way to do this! :-)

(Besides, it's a FAQ.)

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



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

Date: 29 Jan 1998 11:10:41 +0000
From: Richard Caley <spt@cstr.ed.ac.uk>
Subject: Re: Survival Of perl
Message-Id: <eyhk9bj4jta.fsf@liddell.cstr.ed.ac.uk>

In article <34cd006c.22480485@news.halcyon.com>, Frank  (f) writes:

f> I'm referring to any module which will not self extract and install in
f> a windows environment.  

You are going to take some file from the internet and run it
unprotected on your machine with all the privileges it needs to do all
possible setup. I hope you do full backups before each one. Might be
quicker to do the two file copies required by drag and drop.

-- 
Mail me as rjc not spt@cstr.ed.ac.uk		_O_
						 |<



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

Date: Thu, 29 Jan 1998 00:50:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Anthony Licciardi <anthonyl@kodak.com>
Subject: Re: Use of Signals
Message-Id: <Pine.GSO.3.96.980129004407.27354R-100000@user2.teleport.com>

On Wed, 28 Jan 1998, Anthony Licciardi wrote:

> Can anyone give me an example of how to use SIGALRM?

Signals are unreliable under current (and previous) versions of Perl. In
general, if you can avoid using them, you will probably be better off.

> I want to put into a while loop and have SIGALRM set up with a sleep so
> when it has slept for x seconds it breaks out of the while loop. 

The docs recommend against mixing alarm with sleep. But you should be able
to tell sleep how many seconds to sleep for, right? 

    my $time_to_go_on = time + 10;	# ten seconds from now
    while () {				# infinite loop
	&do_something;
	my $time_left_to_sleep = $time_to_go_on - time;
	last unless $time_left_to_sleep > 0;
	sleep $time_left_to_sleep;
    }

Or maybe I'm misunderstanding your need. Hope this helps! 

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



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

Date: Thu, 29 Jan 1998 01:53:29 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: kevinm@crt.com
Subject: Re: Want to determine the subnet networks from a network:subnet combo.
Message-Id: <Pine.GSO.3.96.980129015006.27354c-100000@user2.teleport.com>

On Wed, 28 Jan 1998 kevinm@crt.com wrote:

> Wanting to get a list of the networks that would be derived
> from 10.216 subnetmasked 255.255.240.0.  The subnets that I should get
> back will be 10.216.0 and 10.216.16 - 10.216.240 (in increments of 16)
> but I don't know how exactly to code this.  

    for (my $n=0; $n < 255; $n+=16) {
	print "10.216.$n\n";
    }

Of course, that's just one algorithm. If you have a more general one which
you're not certain how to implement in Perl, please ask again. Of course,
if you're merely in search of an algorithm, perhaps another newsgroup
could be of more help. Good luck! 

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



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

Date: 29 Jan 1998 10:20:53 GMT
From: trs@eerie.fr (Francois Trousset)
Subject: Re: Want to determine the subnet networks from a network:subnet combo.
Message-Id: <6apl65$n4p$1@anais.eerie.fr>

In article <886002623.1144782858@dejanews.com>,
	kevinm@crt.com writes:
> Need help.  Wanting to get a list of the networks that would be derived
> from 10.216 subnetmasked 255.255.240.0.  The subnets that I should get
> back will be 10.216.0 and 10.216.16 - 10.216.240 (in increments of 16)
> but I don't know how exactly to code this.  I've got h2n and it says
> something about bitwise or'ing to do this but I'm really very new at perl
> and am not sure what this is all about.  Any help will be greatly
> appreciated.  Thanks.

	Hi,

	To do something general, you may obtain the increment by
	substracting the netmask to 256.256.256.256 and do a modulo
	256 on each of the 4 bytes otained. Then you get 1.1.16.0.
	Then from the network number, you just have to do a loop for
	each non-null leading byte, that means

	for ( $byte1 = 10 ; $byte1 < 256 ; $byte1 += 1 )
	  { for ( $byte2 = 216 ; $byte2 < 256 ; $byte2 += 1 )
	      { for ( $byte3 = 0 ; $byte3 < 256 ; $byte3 += 16 )
		  { print "$byte1.$byte2.$byte3.0\n"; }
	      }
          }

	Now you get all the known subnet adresses starting from
	10.216.0.0. You may give amelioration to limit the output to
	the set of adresses you are maintaining. Here you have a
	class A net 10.0.0.0, but you seem to only maintain the set
	of adresses of the subnet 10.216.0.0 with mask 255.255.0.0.
	but it could also be 10.216.0.0 mask 255.254.0.0
			or   10.216.0.0 mask 255.252.0.0
			or   10.216.0.0 mask 255.248.0.0
	and then you need to know this mask to be able to give all
	the existing subnet in your set of adress. But, this is no
	more a perl problem.

		Francois Trousset



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

Date: Thu, 29 Jan 1998 11:36:36 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Why can't I unzip?
Message-Id: <genepoolEnJMx1.780@netcom.com>

PaulJCase (pauljcase@aol.com) wrote:
: I just downloaded latest.tar and I can't for the life of me get it open? why?
: Thank you

Downloaded in text mode?


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

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

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