[11579] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5179 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 19 14:07:18 1999

Date: Fri, 19 Mar 99 11:00:23 -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           Fri, 19 Mar 1999     Volume: 8 Number: 5179

Today's topics:
    Re: $var$i or what? <Tony.Curtis@vcpc.univie.ac.at>
    Re: [Systalk] Server Status <david@kasey.umkc.edu>
    Re: [Systalk] Server Status <david@kasey.umkc.edu>
    Re: Any idea to generate charts under Linux ? <curtis.beamus@rehab.state.tx.us>
    Re: Any idea to generate charts under Linux ? <asackett@artsackett.com>
    Re: Can you store %hashes in a DBM file <stampes@xilinx.com>
        Can't read a text file with weird characters in it.  He (Jason Stanley)
    Re: Commercial use of Perl ?'s <cassell@mail.cor.epa.gov>
    Re: DBF Format (brian d foy)
        exporting perl.exp problem <scott.ranzal@mci.com>
    Re: Finding end of line (Larry Rosler)
        Finding the size of a scalar <frankhale@worldnet.att.net>
    Re: foo bar <cassell@mail.cor.epa.gov>
        GNUfind -mmin and find2perl. milburn@ltpmail.gsfc.nasa.gov
    Re: help with perl and win98 <atipson@wesleyan.edu>
    Re: help with perl and win98 <cassell@mail.cor.epa.gov>
    Re: How to connect to a SQL Server database ? <hojo@i-tel.com>
    Re: how to include a init table file without complainin (Larry Rosler)
    Re: How to redirect Output? <pep_mico@hp.com>
    Re: INFINATE LOOPS IN PERL <atipson@wesleyan.edu>
    Re: INFINATE LOOPS IN PERL <atipson@wesleyan.edu>
        inserting large numbers into databases chortik@my-dejanews.com
        join lines from <textarea> <flanker@sonnet.ru>
    Re: join lines from <textarea> (brian d foy)
    Re: Ms-Mail from perl <cassell@mail.cor.epa.gov>
    Re: perl and y2k (was Re: The millennium cometh -- even (Mark-Jason Dominus)
        PERL, compiling, and working with Internet Explorer <steve@pdq.net>
        Q: opening multiple filehandles concurrently? anna@water.ca.gov
    Re: Q: opening multiple filehandles concurrently? (brian d foy)
        Scalars leaked ... (Mitchell Morris)
    Re: script to find user's email or name? <gaving@enter.net>
    Re: script to find user's email or name? <atipson@wesleyan.edu>
    Re: Sorting Problem (Larry Rosler)
    Re: Subset Question (Mark-Jason Dominus)
    Re: Subset Question <Allan@due.net>
    Re: Subset Question <Allan@due.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 19 Mar 1999 18:41:57 +0100
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: $var$i or what?
Message-Id: <83ww0d74wq.fsf@vcpc.univie.ac.at>

Re: $var$i or what?, Tim
<tsawyer@telcom.lgb.cal.boeing.com> said:

Tim> Perhaps this really was a CGI.pm question but
Tim> you know how this group flames those
Tim> questions. Thanks again for you answer.

No, only blatantly off-topic posts get flamed.

The _use of_ CGI.pm would indeed be a perl
question.  Ask away!

tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Fri, 19 Mar 1999 18:25:36 +0000
From: "David L. Nicol" <david@kasey.umkc.edu>
To: systalk@dhs.org, shonson@planetquake.com
Subject: Re: [Systalk] Server Status
Message-Id: <36F296A0.606093D5@kasey.umkc.edu>

Steven Honson wrote:
> 
> Hi,
> I need to get a small script going on one of the servers at school that
> pings the other servers and then makes a html file showing which ones are
> online. http://www.vision.net.au/main/network/servers.html is a good
> example, I have searched the net for hours with no luck. Does any one know
> where I can get a simple program for linux that will ping and generate the
> html file?
> Thanks in Advance
> Steven Honson



it is easier to write one than
to try to pick and choose among sharewares that might exist.

----BEGIN PERL PROGRAM
#!/usr/local/bin/perl

open HTML,">serverreport.html.new";

# put your list of servers to ping in here
@ServerList = qw(
	main.vision.net.au
	www.netscape.com
	secondary.vision.net.au
);


print HTML <<"TOP";
<html><title>simple server upness report</title>
<body bgcolor=chartreuse>
<table border=1>
<tr><th>SERVER</th><th>STATUS</TH></tr>
TOP



foreach $server (@ServerList){
	$pingres = `/usr/sbin/ping -c10 $server`;
	($received) = $pingres =~ m/(\d+) packets received/;
	# may want to expand this somewhat
	print HTML <<"ENTRY";
<tr>$server<td></td><td>$pingres</td></tr>
ENTRY

};

print HTML <<"END";
</table>
<!-- 
     this page generated by Status-O-Matic 0.1,
     copyleft 1999 david nicol consulting, kansas city missouri
     be kind
-->
<a href=mailto:shonson@planetquake.com> email steve honson</a>
</body></html>
END


rename "serverreport.html.new", "serverreport.html";


-----END PERL PROGRAM


Make a cron entry to change to a htdocs directory and run it;
the running user will need write privs for the directory




_______________________________________________________________________
  David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu
             ++++ stop the execution of Mumia Abu-Jamal ++++
  ++++ more info: http://www.xs4all.nl/~tank/spg-l/sigaction.htm ++++


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

Date: Fri, 19 Mar 1999 18:33:49 +0000
From: "David L. Nicol" <david@kasey.umkc.edu>
To: systalk@dhs.org
Subject: Re: [Systalk] Server Status
Message-Id: <36F2988D.A5785116@kasey.umkc.edu>

"David L. Nicol" wrote:

>         $pingres = `/usr/sbin/ping -c10 $server`;
>         ($received) = $pingres =~ m/(\d+) packets received/;
>         # may want to expand this somewhat
>         print HTML <<"ENTRY";
> <tr>$server<td></td><td>$pingres</td></tr>
> ENTRY

Sorry, the entry should be

<tr>$server<td></td><td>$received</td></tr>


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

Date: Fri, 19 Mar 1999 10:42:55 -0600
From: "Curtis Beamus" <curtis.beamus@rehab.state.tx.us>
Subject: Re: Any idea to generate charts under Linux ?
Message-Id: <7cturb$p8u$1@news.tdh.state.tx.us>

I do pretty much the same thang. I use perl to summarize and drive the
process. I use perl to create datafiles that are then used in gnuplot to
create the charts as postscript files. I then use ghostscript 5.1 to read
the postscript files and create Adobe pdf files of the charts (saves LOTS of
space) and you can package your charts into logical groupings. It will also
do jpegs.


Y W Wong wrote in message <7cttcs$bjh$1@imsp009a.netvigator.com>...
>I am writing a perl script to generate HTML file hourly and upload to a web
>server.
>It use Expect to telnet to a host to collect real time data every 15
>minutes.
>The perl script used to generate HTML file based on the captured data.
>
>Now, I would like to generate some simple bar charts ( Prefered in jpeg
>format )
> based on the captured data.
>
>Any idea about what tools or language should be used ?
>
>Regards,
>
>Y W Wong
>
>
>




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

Date: Fri, 19 Mar 1999 18:50:13 GMT
From: Art Sackett <asackett@artsackett.com>
Subject: Re: Any idea to generate charts under Linux ?
Message-Id: <F%wI2.30$h3.170910208@news.frii.net>

On Sat, 20 Mar 1999 00:25:24 +0800 in alt.html Y W Wong 
<ywwong_hk@hotmail.com> honored us all with these words:
YWW: I am writing a perl script to generate HTML file hourly and upload to a web
YWW: server.
YWW: It use Expect to telnet to a host to collect real time data every 15
YWW: minutes.
YWW: The perl script used to generate HTML file based on the captured data.
YWW: 
YWW: Now, I would like to generate some simple bar charts ( Prefered in jpeg
YWW: format )
YWW:  based on the captured data.
YWW: 
YWW: Any idea about what tools or language should be used ?

Well, since you're already using perl, you might as well stay with
it. I don't know about you, but for me, changing gears to use two
languages in one application is a pain in the butt. 

Perhaps the easiest way to do this would be to use something out of
CPAN. There are quite a handful of modules that will make graphics.
I guess the choice of which to employ would take some further
research on your part, and would depend upon your tastes, so I'm
hesitant to recommend this one or that one out of concern that what
I think is great you might find unwieldy.

Hope this helps!

----   Art Sackett   ----
Independent Web Developer
http://www.artsackett.com


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

Date: 19 Mar 1999 15:39:22 GMT
From: Jeff Stampes <stampes@xilinx.com>
Subject: Re: Can you store %hashes in a DBM file
Message-Id: <7ctr3a$7q1@courier.xilinx.com>

Get thee to CPAN and get MLDBM:

perldoc MLDBM

NAME
     MLDBM - store multi-level hash structure in single level
     tied hash

SYNOPSIS
         use MLDBM;                   # this gets the default, SDBM
         #use MLDBM qw(DB_File);

         $dbm = tie %o, MLDBM [..other DBM args..] or die $!;


DESCRIPTION
     This module, intended primarily for use with DBM packages,
     can serve as a transparent interface to any TIEHASH package
     that must be used to store arbitrary perl data, including
     nested references.


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


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

Date: Fri, 19 Mar 1999 10:48:27 -0600
From: jstanley@mmm.com (Jason Stanley)
Subject: Can't read a text file with weird characters in it.  Help.
Message-Id: <7ctv4s$cd3$1@magnum.mmm.com>

I am trying to read through the text file below, but when it hits the odd
(ascii?) characters it won't read the rest of the file.  How do I get it to
ignore all the strange characters and read all the words.

Thanks,
Jason



      =   H       J      K S  $ p v a q&   t 4   A The file was
repaired.u M The file
F:\Tsd\Tsdusers\US275612\MSOFFICE\WINWORD\Volition\~WRL2838.TMP
was infected with the WM.MDMA.D virus.C P
F:\Tsd\Tsdusers\US275612\MSOFFICE\WINWORD\Volition\~WRL2838.TMP s ROSEDALE
 u SYSTEM
 v WM.MDMA.D S Windows Auto-Protect  X     K S  ~  p v a q&   t 5:  
A The file was repaired.b M The file
F:\Tsd\Tsdusers\US331282\LABELS\~WRD2678.tmp
was infected with the WM.MDMA.D virus.0 P
F:\Tsd\Tsdusers\US331282\LABELS\~WRD2678.tmp s ROSEDALE
 u SYSTEM
 v WM.MDMA.D S Windows Auto-Protect  "  J  K S  : p v a r&   t V  
A Unable to repair this file.| M The file
F:\Tsd\Tsdusers\US295449\1-Projects\Septon\MicroPhoto1\~WRD3829.tmp
is infected with the W97M.Marker.A virus.G P
F:\Tsd\Tsdusers\US295449\1-Projects\Septon\MicroPhoto1\~WRD3829.tmp s
ROSEDALE u US295449 v W97M.Marker.A S Windows Auto-Protect  p  X  K S
> p v a r&   t V  # A Unable to quarantine this file.| M The file
F:\Tsd\Tsdusers\US295449\1-Projects\Septon\MicroPhoto1\~WRD3829.tmp
is infected with the W97M.Marker.A virus.G P
F:\Tsd\Tsdusers\US295449\1-Projects\Septon\MicroPhoto1\~WRD3829.tmp s
ROSEDALE u US295449 v W97M.Marker.A S Windows Auto-Protect  =  "  K S
= p v a r&   t V  " A Access to the file was denied.| M The file
F:\Tsd\Tsdusers\US295449\1-Projects\Septon\MicroPhoto1\~WRD3829.tmp
is infected with the W97M.Marker.A virus.G P
F:\Tsd\Tsdusers\US295449\1-Projects\Septon\MicroPhoto1\~WRD3829.tmp s
ROSEDALE u US295449 v W97M.Marker.A S Windows Auto-Protect  p  K S
6 p v a r&   t V   A The file was repaired.} M The file
F:\Tsd\Tsdusers\US295449\1-Projects\Septon\MicroPhoto1\~WRD3829.tmp
was infected with the W97M.Marker.A virus.G P
F:\Tsd\Tsdusers\US295449\1-Projects\Septon\MicroPhoto1\~WRD3829.tmp s
ROSEDALE u US295449 v W97M.Marker.A S Windows Auto-Protect




Opinions expressed herein are my own and may not represent those of my employer.



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

Date: Fri, 19 Mar 1999 10:27:15 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Commercial use of Perl ?'s
Message-Id: <36F29703.5A7ED92E@mail.cor.epa.gov>

Tad McClellan wrote:
> 
> Krusty276 (krusty276@aol.com) wrote:
> : Hey our company is using ActivePerl to develop some software, there is no
> : licencing fee you need to pay for commercially selling our software that was
> : developed in active Perl 5 is there ?
> 
>    What did the license say?

I.e., Perl comes with full (and very generous) licensing information,
and you really need to read it.  No one should be using products
whose licensing agreements they have not read, when doing commercial
software development.  Perl is very forgiving (as is Larry :-), but
other software authors/companies would have you in a legal headlock
faster than you can say 'copyleft'.
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 19 Mar 1999 13:11:14 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: DBF Format
Message-Id: <comdog-ya02408000R1903991311140001@news.panix.com>

In article <7cru78$dbu$1@nnrp1.dejanews.com>, mtcorey@my-dejanews.com posted:

> I was told that it was possible to use the DBD::xBase module to write data
> out in DBF format.  I have never used the DBD::xBase module, so I am totally
> lost.  What I need to do is extract the data from a Sybase SQL Server
> database (this I can do using sybperl), but I have no idea how to write the
> extracted data out in DBF format using DBD::xBase.  Has anyone ever performed
> this?  If so any help would be greatly appreciated.  Thanks.

the Xbase docs are really good and should get you where you are going.
you should, in general, at least try something before asking for help.

> I have access to this newsgroup through deja-news, so if replies could be sent
> to mcorey@edoc.com that would be appreciated.  Thanks again.

just search for responses to your post.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Fri, 19 Mar 1999 18:23:10 GMT
From: "Scott Ranzal" <scott.ranzal@mci.com>
Subject: exporting perl.exp problem
Message-Id: <iCwI2.149$zG2.988@PM01NEWS>

install of perl5.005_02 on AIX4.3.1.  Running make and get the following
WARNING messages.


exported symbol not defined: Mycalloc
exported symbol not defined: Myfree
 ...

basically every entry in the perl.exp file generates this WARNING.

what can i do to fix this error message

scott

scott.ranzal@mci.com






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

Date: Tue, 16 Mar 1999 14:51:08 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Finding end of line
Message-Id: <MPG.11588035f5259a04989767@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36EECAA2.B09CFD82@giss.nasa.gov> on Tue, 16 Mar 1999 
16:18:26 -0500, Jay Glascoe <jglascoe@giss.nasa.gov> says...
> "J=FCrgen Exner" wrote:
> > However there is a
> > - line-feed character (LF)
> 
> ascii value 12 <=3D> "\f" <=3D> "\014" <=3D> aka <ctrl-M>

The ASCII line-feed character is not "\f" -- value 12 is the form-feed 
character.  The ASCII line-feed character is in fact value 10, which was 
appropriated by Unix and *interpreted* as the newline character.  There 
is no such thing in ASCII as a newline character.

And control-M is 13, which is the carriage-return character.

> > - and a carriage return character (CR)
> 
> ascii value 13 <=3D> "\r" <=3D> "\015"
> 
> - and a newline character
> 
> ascii value 10 <=3D> "\n" <=3D> "\012"

On the TTYs that were the standard terminals when Unix was created, the 
raw character 10 did nothing more than move the paper down one line.  A 
character 13 was required also, to position at the start of the next 
line.  The Unix invention (supported as far back as the B language) was 
to combine these two *for internal representation and for external data 
storage* into one character, and to rely on the TTY driver to expand it 
into the required two characters for physical output.  The MS-DOS 
disaster was to require both characters to end a line in all 
representations.  That way the TTY driver could be as dumb as they were 
(actually the predecessor operating system that Gates ripped off).

By the way, what are all those ugly <=3D> pollutions in your post?

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


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

Date: 19 Mar 1999 17:06:04 GMT
From: Frank Hale <frankhale@worldnet.att.net>
Subject: Finding the size of a scalar
Message-Id: <36F284FC.EB758D2E@worldnet.att.net>

Say I want to have a scalar that stores a string and I don't want it to
be larger than 256kb how can I get the size of it to test for this?

Thanx

-- 
From:      Frank Hale
Email:     frankhale@worldnet.att.net   
ICQ:       7205161			
Website:   http://www.franksstuff.com


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

Date: Fri, 19 Mar 1999 10:11:57 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: foo bar
Message-Id: <36F2936D.AB0DA7@mail.cor.epa.gov>

While this is a little bit off-topic, let me point out that
the explanations for foo and bar can be found in the Hacker's
Jargon File, downloadable via a simple search on the Web. IIRC,
the etymology of 'foo' is probably from Smokey Stover.  Then
'bar' appeared as a natural sequel to foo, courtesy of the
wordplay on FUBAR.

Laurence Leider wrote:
> 
> Seems like nobody remembers FUBAR being explained in Tango & Cash many
> years ago.  Even after the explanation, Cash (Sylvester Stallone) did
> not really understand FUBAR until Tango (Mark Russell) stuffed a
> grenade down the bad guy's pants and well, the guy was FUBAR shortly
> thereafter.
> 
> On Mon, 14 Dec 1998 09:34:50 -0800, Marc <metalmd@earthlink.net>
> wrote:
> 
> >It's fubar, if you're referring to the Private Ryan movie.  Not sure if it
> >is the same thing here, but it probably is. And it means  f#$%^ up beyond
> >all recognition.  You can add it the first word.
> >
> >Marc
> >
> >Todd Smith wrote:
> >
> >> where's this foo-bar stuff come from? I heard it in that "Search for
> >> Private Ryan" movie. What's it mean?, and what's it got to do with Perl?
> >>
> >> --
> >> _______________
> >> Todd Smith
> >> Perl Programmer
> >> ITC^Deltacom
> >

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 19 Mar 1999 16:56:16 GMT
From: milburn@ltpmail.gsfc.nasa.gov
Subject: GNUfind -mmin and find2perl.
Message-Id: <7ctvj4$6cf$1@nnrp1.dejanews.com>

I'm trying to write a perl script that will monitor a directory and
notify me when new files arrive by checking the directory every 5 minutes.
I'd like to use GNUfind because it has the "amin,cmin,mmin" flags to tell
you the file status within N minutes ago. I don't want to process the
file if it's still being ftp'd.

Is there a way to modify find2perl to handle "-mmin" or does anyone
know of another method I could use to accomplish this.

thanks,
-shane

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


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

Date: Fri, 19 Mar 1999 13:11:04 -0500
From: Andrew Tipson <atipson@wesleyan.edu>
Subject: Re: help with perl and win98
Message-Id: <36F29338.2A0CBA67@wesleyan.edu>

urg- I can't seem to make the command line work in my Win98 version of perl-
is there any way to make this script work independantly?  It may be that my
version just isn't cofigured properly, I'll check it again.

Sean Phillips wrote:

> Andrew -
>
> Here is a piece of code that I have used to do a similar task.   It
> wouks UNIX, NT and 95 - I have not tried it on 98...
>
> In this form, it works from the command line as
> "perl cgigetdoc.pl http://www.slashdot.com/ultramode.txt"
> But I'm sure that you can modify it to your liking...
>



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

Date: Fri, 19 Mar 1999 10:44:04 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: help with perl and win98
Message-Id: <36F29AF4.E25A316D@mail.cor.epa.gov>

Andrew Tipson wrote:
> 
> Hi, I'm under the sad restriction of using windows98 for this particular
> server, and I'm trying to access remote documents to parse for a daily
> news update.  Unfortunately, my knowledge of how to do this is limited
> to unix, and none of those system commands work directly from windows.
> How can I do it win windows?  Basically I want to read
> http://www.slashdot.com/ultramode.txt into an array, which I'll then
> parse accordingly.  What should I use to download this remote document?
> Any example code would be very much appreciated.

Assuming you've got a recent version of ActivePerl, you don't
have to go anywhere to get code for this.  Check out the
LWP::Simple module, which has docs in the on-line ActivePerl Help.
Then look at an example under the LWP module, and you should be
able to extrapolate...

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 19 Mar 1999 17:54:05 GMT
From: hojo <hojo@i-tel.com>
Subject: Re: How to connect to a SQL Server database ?
Message-Id: <7cu2vi$ait$1@nnrp1.dejanews.com>

Well, how do you want to connect?  Through a web server?  Or, just a stand
alone perl script?  If it is through a web server, you can use the
sybase/sybperl modules to do an ansi connect.  It is rather easy.  Refer to
this page for more info:
http://www.mbay.net/~mpeppler
-hojo

In article <36F23D17.1B60112B@pacific.net.sg>,
  Simon Ng <simon_ng@pacific.net.sg> wrote:
> Hi how to connect to a SQL Server database using ODBC.
>
> Thanks
>
> Regards,
> Simon Ng
>
>

=-=-=-=-=-=-=-=-=-=
David Hajoglou
Sys. Admin., Abbreviator
=-=-=-=-=-=-=-=-=-=

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


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

Date: Tue, 16 Mar 1999 15:34:12 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: how to include a init table file without complaining from "use strict"
Message-Id: <MPG.11588a4e13d6a76989769@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <YNAH2.278$p4.115121@burlma1-snr2> on Tue, 16 Mar 1999 
22:19:38 GMT, Tungning Cherng <cherng@uuman.bbn.com> says...
 ...
> % cat a.pl
> my %largeTable=(
>    'a' , '1',
>    'b' , '2',
> );
> 
> % cat b.pl
> use strict;
> require "a.pl";
> print "$largeTable{'a'}\n";
> 
> Now run "perl b.pl", I got an error:
>     Global symbol "largeTable" requires explicit package name ...
> 
> I have to remove "use strict" line, and use global variable to make it work.
> I don't think it is the right way.
> 
> Could some one tell me how to solve the problem by using "use strict"?

  % cat a.pl
  use strict;
  use vars '%largeTable';
  %largeTable=(
     'a' , '1',
     'b' , '2',
  );
  
  % cat b.pl
  use strict;
  use vars '%largeTable';
  require "a.pl";
  print "$largeTable{'a'}\n";

By the way, better Perl style is to use underscore to separate words in 
an identifier, not those hideous inner caps.  Perl ne Java.

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


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

Date: Fri, 19 Mar 1999 19:16:22 +0100
From: Pep Mico <pep_mico@hp.com>
To: sholden@cs.usyd.edu.au
Subject: Re: How to redirect Output?
Message-Id: <36F29476.28ACDDCF@hp.com>

Hello Sam,

Running my Script as you are suggesting redirection works "perl myscript.pl >
output.txt"

The problem only occurs when I type directly my script in the command Line. I
think that is better to use your method for this case.

Regards
Pep


Sam Holden wrote:

> On Thu, 18 Mar 1999 08:03:27 -0500, Allan M. Due <Allan@due.net> wrote:
> >Pep Mico wrote in message <36F0C2AB.D37B932A@hp.com>...
> >:Hello,
> >:I'm Using Activestate perl (perl for win32). And I'm trying to redirect
> >:the output of my scripts using the simply MS-DOS redirecting like this.
> >:myscript.pl > output.txt
> >:But output.txt doesn't receive anything it has the lengh of "0" zero
> >:bytes.
> >:My "sophisticated" script is only this line
> >:print "hello\n";
> >:Why It doesn't work? How can i redirect the output of my Script?
> >
> >Something else must be goint on. If, at the prompt, I type
> >
> >perl myscript.pl > output.txt
> >, and myscript.pl contains
> >print "hello\n";
> >
> >then output.txt contains hello.  Are you sure your script actually runs?
>
> Windows seems to break redirections when associations are used in
> running a program. Since the original post said they used
> 'myscript.pl > output.txt', that is probably the reason.
>
> I don't know the solution (I suspect it's some tweaking of the association),
> but searching on dejanews, or a win32/perl place somewhere should turn
> something up.
>
> --
> Sam
>
> If your language is flexible and forgiving enough, you can prototype
> your belief system without too many core dumps.
>         --Larry Wall



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

Date: Fri, 19 Mar 1999 12:58:19 -0500
From: Andrew Tipson <atipson@wesleyan.edu>
Subject: Re: INFINATE LOOPS IN PERL
Message-Id: <36F2903B.43A6E0DD@wesleyan.edu>

Indeed, there is a command for precisely this purpose-

alarm()

you're saved!

Chris Denman wrote:

> What is happening, is that once in a blue moon, the code gets itself into a
> loop and hogs the server.  None of my perl scripts should get into a loop
> and should terminate within seconds.
>
> Is it possible to detect whether a script is in a loop, or even if it has
> been running for more than say, 20 seconds?  If so, can these programms be
> terminated upon this detection?
>



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

Date: Fri, 19 Mar 1999 12:58:23 -0500
From: Andrew Tipson <atipson@wesleyan.edu>
Subject: Re: INFINATE LOOPS IN PERL
Message-Id: <36F2903F.80681792@wesleyan.edu>

Indeed, there is a command for precisely this purpose-

alarm()

you're saved!

Chris Denman wrote:

> What is happening, is that once in a blue moon, the code gets itself into a
> loop and hogs the server.  None of my perl scripts should get into a loop
> and should terminate within seconds.
>
> Is it possible to detect whether a script is in a loop, or even if it has
> been running for more than say, 20 seconds?  If so, can these programms be
> terminated upon this detection?
>



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

Date: Fri, 19 Mar 1999 18:07:35 GMT
From: chortik@my-dejanews.com
Subject: inserting large numbers into databases
Message-Id: <7cu3on$bfl$1@nnrp1.dejanews.com>

Is it possible to prevent perl from casting a 17 digit long string into a
double before it is inserted into a database.  the field in the database
table is set to recieve a 17 character string, but perl casts it into a
double, chopping off the least significat digit.  is there a way around this?

thanks in advance for the help.

mlr

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


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

Date: Fri, 19 Mar 1999 21:12:05 +0300
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: join lines from <textarea>
Message-Id: <7cu3u9$isb$1@bison.rosnet.ru>

Hi

My form has <textarea> (scrollable box).

Script must join all lines from <textarea> into one line.. Note, that when
I'll read this line again and show its content in 'text/html' it must be
shown as they were. For example, after joining I need to restore all CRLFs
in the text...

How to release it? ;-)

--
Best wishes,

Michael Yevdokimov

Email: flanker@sonnet.ru
ICQ: 30874618
-------------------------------------------------
>> Developers Support Site <<
Web: http://developer.tsx.org
http://www.basicnet.sonnet.ru
-------------------------------------------------





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

Date: Fri, 19 Mar 1999 13:27:38 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: join lines from <textarea>
Message-Id: <comdog-ya02408000R1903991327380001@news.panix.com>

In article <7cu3u9$isb$1@bison.rosnet.ru>, "Michael Yevdokimov" <flanker@sonnet.ru> posted:

> My form has <textarea> (scrollable box).
> 
> Script must join all lines from <textarea> into one line.. Note, that when
> I'll read this line again and show its content in 'text/html' it must be
> shown as they were. For example, after joining I need to restore all CRLFs
> in the text...

how about using the join() function?

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Fri, 19 Mar 1999 10:17:57 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Ms-Mail from perl
Message-Id: <36F294D5.A7854DF5@mail.cor.epa.gov>

Dan Sugalski wrote:
> 
> massimobalestra@my-dejanews.com wrote:
> : Hi, Does somebody knows if there is a way to send a mail Through a server
> : Microsoft Mail (Ms-Mail) without having a gateway? Or  (Off Topic) does
> : exists there a (freeware) gateway from unix to ms-mail?
> 
> : I know perl and unix but not ms-mail server.
> 
> Does the MSMail server do SMTP? If so, you can always connect to it and
> send mail directly. If not, you could always see about sneaking a linux
> box in there somewhere... :)

This is well-covered in the ActivePerl FAQ, which the poster should
have given the subject line.  Check out the 'Windows 95/NT' section,
question 'How do I send e-mail from Perl for Win32?'.  The answer
there has code snippets, pointers to Perl programs, pointers to
mail programs, and other swell advice.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 19 Mar 1999 12:24:45 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: perl and y2k (was Re: The millennium cometh -- eventually)
Message-Id: <7cu18t$53q$1@monet.op.net>

In article <19990315.123459.1O1.rnr.w164w_-_@locutus.ofB.ORG>,
Russell Schulz  <Russell_Schulz@locutus.ofB.ORG> wrote:
>if memory serves, it was MJD who pointed out the basic things you would
>do with a year, and to handle them correctly was at least as long (and
>in at least one case longer) than to handle them incorrectly, given the
>problematic representation (year-1900).

Yes.  My point is that the interface to `localtime' is very badly
desgined.  It offers a convenience feature that is *only* convenient
if you are *trying* to commit a Y2K error.

A long time ago there was a unix filesystem utility that would print
a prompt something like this:

	About to erase filesystem; hit ctrl-C within 10 sec to abort

This was, ridiculed, quite rightly, as a monstrously bad user
interface, and has since been replaced.  If someone using this program
accidentally loses their filesystem, whose fault is it?  Is the the
fault of the operator, who didn't carefully read the manual or follow
the printed directions?  Perhaps, but I think the program and its
author have to shoulder some of the blame.  

The `localtime' interface is similar.  Its most convenient, carefully
engineered default case is to do the wrong thing.  To do the right
thing, you have to make a special effort to defeat the built-in
behavior.  And the built-in behavior is so egregiously stupid and
worthless that it takes you by surprise.  

Note for people not familiar with `localtime': `localtime' returns the
current time as represented by a list of values including seconds,
minutes, hours, and so on.  The `year' member of this list is not the
current year, or even the last two digits of the current year, but
rather _the current year minus 1900_, so that it looks like the last
two digits of the year, and invites you to use it that way, even
though such use will fail next year when the `year' value will be `100'.

If a gun fires backwards by default, and people are injured, that is
partly the gun manufacturer's fault, no matter how carefully the flaw
is documented.  The gun has a problem of killing the users
accidentally; it is a problem in the gun.  It is not right to put all
the blame on the person who pulled the trigger.  There is a
reasonable, normal way for guns to work, and this gun does not work
that way.

There is a reasonable, normal way for time functions to work, and
localtime does not work that way.  When it injures the user, you
cannot put all the blame on the user; the poor design is also to
blame.  Software designers are not any more exempt from responsibility
for bad engineering than are the designers of any other artifacts.
Saying `Perl does not have a Y2K problem' is naive.  `localtime', and
by extension Perl, has an egregiously bad design that encourages Y2K
errors as the most normal and common form of operation.  This is, in
fact, a problem with localtime, and not with the programmers who use
it or with anyone else.




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

Date: Fri, 19 Mar 1999 12:44:54 -0600
From: Steve Lush <steve@pdq.net>
Subject: PERL, compiling, and working with Internet Explorer
Message-Id: <36F29B26.1655412F@pdq.net>

Hi, I was going to attempt to compile the CPAN source of Perl, and I
wanted to know since it says in the docs "You should have VC++ 4.2..
blah blah" if anyone  has tried it with 4.1 (since that's all I have).
I also looked a little into Ming32 but THAT looked so arduous that I
started to wish for death when I was trying to find some references to
how to use Ming to compile the makefile.

Also, I have not been ever able to use perl on a IIS4 server to come up
in Internet Explorer.  It asks for the password to the page so I know
that works, but it only has the source of a default looking page.  I
call it with PerlIS.dll as the extension .pl in the scriptmapping.  When
I telnet to the machine's port 80, the page seems to come up slowly,
piece-by-piece.


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

Date: Fri, 19 Mar 1999 18:12:57 GMT
From: anna@water.ca.gov
Subject: Q: opening multiple filehandles concurrently?
Message-Id: <7cu42n$bvv$1@nnrp1.dejanews.com>

Is it possible to have more than one filehandle open concurrently?  I am
writing output to one filehandle.  But in the middle of the report, I want to
write out a section of the report to another report while still writing to
the original report.  The first filehandle/report is a full version, while I
want the second filehandle/report to be a short version.  What is the best
way to go about my task?

My skeleton code looks like this:
-------------------------------
open(REPORT, ">$reportOut") || die "\nCan't open report: $!\n";
 ...
select REPORT;
write;
 ...
close(REPORT) || die "\nCan't close report: $!\n";


Thanks in advance for your reply,
Anna

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


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

Date: Fri, 19 Mar 1999 14:01:21 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Q: opening multiple filehandles concurrently?
Message-Id: <comdog-ya02408000R1903991401210001@news.panix.com>

In article <7cu42n$bvv$1@nnrp1.dejanews.com>, anna@water.ca.gov posted:

> Is it possible to have more than one filehandle open concurrently?

yes.  you even start off with a couple open already :)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: 19 Mar 1999 18:21:35 GMT
From: mgm@unpkhswm04.bscc.bls.com (Mitchell Morris)
Subject: Scalars leaked ...
Message-Id: <slrn7f55df.j6i.mgm@unpkhswm04.bscc.bls.com>

I have a perl interpreter embedded into a larger application, where the
surrounding app periodically runs the following snippet:

	[suitably initialize xs_init, ac, and av]

	PerlInterpreter* perl = perl_alloc();
	perl_construct(perl);
	int rc = perl_parse(perl, xs_init, ac, av, NULL);
	if(!rc)
		rc = perl_run(perl);
	PL_perl_destruct_level = 1;
	perl_destruct(perl);
	perl_free(perl);

For some class of script errors, I get a message from the interpreter
"Scalars leaked: 1". So far, it has always been a compilation error that
generates the message. The puzzling part is that the same "Scalars leaked"
message is generated for every script executed from that point on until the
application is restarted, even if the script compiles and executes
successfully.

What did I do to get this message in the first place, and how can I recover
from it? Any guidance would be deeply appreciated.



-- 
Mitchell Morris

When the people are being beaten with a stick, they are not much happier if
it is called "The People's Stick".
	-- Mikhail Bakunin (Statism and Anarchy) 


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

Date: Fri, 19 Mar 1999 12:21:52 -0500
From: "Gavin" <gaving@enter.net>
Subject: Re: script to find user's email or name?
Message-Id: <36f286e7@news3.enter.net>

There is a variable named $ENV{HTTP_FROM}  I havent used in quite a long
time, and I am not sure if it works.  I think for it to work the user has to
use there browsers email program, and there email has to be supplies in it.
Give that a try.  If not its not possible.

HTH
Gavin


Bahram Pourghadiri <bahram@onpulse.com> wrote in message
news:01be724f$e55e54e0$0101020a@bahram...
> Does anyone know of a script for secretly finding out a user's name or
> email address (for example when they click on a link) or basically as much
> info as possible.
>
> I have a very good reason for wanting this script. There is somebody
> annoying me and I want to find out who they are.
>
> Best regards
>
> Bahram Pourghadiri
> bahram@onpulse.com




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

Date: Fri, 19 Mar 1999 12:55:28 -0500
From: Andrew Tipson <atipson@wesleyan.edu>
Subject: Re: script to find user's email or name?
Message-Id: <36F28F90.772717B6@wesleyan.edu>

Basically, there isn't any good way to find out a user's email without plain
asking them for it- some tricks will work sometimes, but pretty rarely with
modern browsers.  It is pretty easy to find out their IP address however, just
have the link start a script that will save or mail you $ENV{'REMOTE_ADDR'}
With a bit of detective work this can often net you some leads.  At the very
least, if your server has such a capability, you could ban their ip (if it's
static)

Bahram Pourghadiri wrote:

> Does anyone know of a script for secretly finding out a user's name or
> email address (for example when they click on a link) or basically as much
> info as possible.
>
> I have a very good reason for wanting this script. There is somebody
> annoying me and I want to find out who they are.
>
> Best regards
>
> Bahram Pourghadiri
> bahram@onpulse.com



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

Date: Tue, 16 Mar 1999 14:58:31 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting Problem
Message-Id: <MPG.115881f0325d8ecf989768@nntp.hpl.hp.com>

In article <7cmj32$he6$2@client2.news.psi.net> on 16 Mar 1999 21:39:46 
GMT, Abigail <abigail@fnx.com> says...
+ Frank de Bot (debot@xs4all.nl) wrote on MMXXII September MCMXCIII in
+ <URL:news:36ED68D0.8D14D81D@xs4all.nl>:
+ !! I have an array:
+ !! 
+ !! $ar[0] = "14 || Some Text here";
+ !! $ar[1] = "4 || Lalalala";
+ !! $ar[2] = "7 || Hello World";
+ !! 
+ !! How can I sort that the array is this:
+ !! 
+ !! $ar[0] = "4 || Lalalala";
+ !! $ar[1] = "7 || Hello World";
+ !! $ar[2] = "14 || Some Text here";
+ 
+ 
+ @ar = @a [1, 2, 0];

What is @a ?  "Use of uninitialized value at ..."

+ HTH. HAND.

I'm sure that your answer (corrected) helps a great deal.  Not.

You are going out of your way to live up to your reputation in the 
newsgroup.  And to think that some people here defend you!

Have a Nice Day. 

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


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

Date: 19 Mar 1999 12:35:58 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Subset Question
Message-Id: <7cu1tu$57a$1@monet.op.net>

In article <7ctpag$gu4$1@gaia.ns.utk.edu>,
Robert Gwynne <gwynne@utkux.utk.edu> wrote:
>I'm trying to write an algorithm that gives me all combinations of an array
>such that  if @array = (a b c d), it produces:
>ab ac ad bc bd cd
>    or
> aa ab ac ad bb bc bd cc cd

sub combinations {
  my ($n, @a) = @_;
  return map {[$_]} @a if $n == 1;
  return [] if $n == 0;
  my @result;
  while (@a) {
    my $e = shift @a;
#    push @result, map {[$e, @$_]} combinations($n-1, @a);
##   push @result, map {[$e, @$_]} combinations($n-1, $e, @a);
  }
  @result;
}


Uncomment the (#) line for the first behavior.
Uncomment the (##) line for the second behavior.



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

Date: Fri, 19 Mar 1999 13:08:31 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Subset Question
Message-Id: <7cu3e6$1md$1@camel18.mindspring.com>

Robert Gwynne wrote in message <7ctpag$gu4$1@gaia.ns.utk.edu>...
:I'm trying to write an algorithm that gives me all combinations of an array
:such that  if @array = (a b c d), it produces:
:ab ac ad bc bd cd
:    or
: aa ab ac ad bb bc bd cc cd
:I've tried variations on the example program below to no avail. It seems
:that I should be able to delete the first item of the array each time
:through the loop and end up with all the combinations. However, if I
comment
:out the penultimate line "shift(@array);", I get all of the combinations.
:For example:
:aa ab ac ad ba bb bc bd ca cb cc cd da db dc dd
:They are there, but there's too much redundancy for what I want.
:It looks like a problem for CS101, but I'm at a loss to figure out what the
:problem is.
:#!/usr/local/bin/perl -w
:@array = qw(a b c d);
:foreach $item(@array){
:    foreach $element(@array){
:        print "$item times $element\n";
:}
:    shift(@array);
:}

Lunch break one-liner:

my @keep=map{push(@temp,$_);$in=$_;map{$temp[$_].$in}(0..$#temp-1)}@array;

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Down that path lies madness.  On the other hand, the road to hell is paved
with melting snowballs.
 - Larry Wall in <1992Jul2.222039.26476@netlabs.com>





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

Date: Fri, 19 Mar 1999 13:13:21 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Subset Question
Message-Id: <7cu3n7$1n7$1@camel18.mindspring.com>

Allan M. Due wrote in message <7cu3e6$1md$1@camel18.mindspring.com>...
:Robert Gwynne wrote in message <7ctpag$gu4$1@gaia.ns.utk.edu>...
::I'm trying to write an algorithm that gives me all combinations of an
array
::such that  if @array = (a b c d), it produces:
::ab ac ad bc bd cd
::    or
:: aa ab ac ad bb bc bd cc cd

:Lunch break one-liner:
:
:my @keep=map{push(@temp,$_);$in=$_;map{$temp[$_].$in}(0..$#temp-1)}@array;

Oops forgot for the second behavior set change:
(0..$#temp-1)
to
(0..$#temp)
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
A computer lets you make more mistakes faster than any invention in human
history - with the possible exceptions of handguns and tequila.
 - Mitch Ratliffe





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

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

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

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5179
**************************************

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