[6508] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 133 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 17 18:10:22 1997

Date: Mon, 17 Mar 97 15:00:22 -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           Mon, 17 Mar 1997     Volume: 8 Number: 133

Today's topics:
     Re: AntiSPAM is as bad as SPAM (was Can you help me wit (Ronald L. Parker)
     Re: AntiSPAM is as bad as SPAM <dbenhur@egames.com>
     Assorted Perl (html parsing) questions (Dan Sumption)
     Can't open file <swildish@pine.shu.ac.uk>
     Re: getting IP address with gethostbyaddr ? (Charles DeRykus)
     HELP Linking Hash table to DBM database <millin@eij.gsfc.nasa.gov>
     Re: Help needed with time and Perl (Tad McClellan)
     Re: Help w/Perl5 & Cross Platfomr Perl <johnsone@camax.com>
     Help with Pattern Matching <mwick@toy.mem.ti.com>
     Re: HELP: delete and chmod file with perl (Steven Sajous)
     Re: How to sort? (Steven Sajous)
     Re: learning perl <bd@internet-etc.com>
     Need help to run two perl programs <eermmb@engunx.unl.edu>
     Newbie Perl question (Unknown)
     Re: Newbie Perl question (Unknown)
     Re: perl -w (Mike Stok)
     Re: Perl Compiler (Jon Bell)
     Re: Perl Compiler <jday@msmailgw.sdsmt.edu>
     Re: Perl for NT ***Help**** <flg@vhojd.skovde.se>
     Re: Perl5.003 3x memory inefficient, Perl4.003 better? (Ilya Zakharevich)
     Setting PATH env. variable problem... (Tan B Tran)
     Re: term 'regular expressions' considered undesirable (Abigail)
     Re: What's a good Perl book? <johnsone@camax.com>
     Re: What's wrong with "an email" (was: How to spam - le (Ross Howard)
     Re: Why does string comparison use signed chars? (Ilya Zakharevich)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 17 Mar 1997 21:41:56 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: AntiSPAM is as bad as SPAM (was Can you help me with this script?)
Message-Id: <332eb99b.31145874@10.0.2.33>

On Mon, 17 Mar 1997 10:17:45 -0500, John M Chambers
<jc@hendel.mko.dec.com> wrote:
>Well, maybe there is, but if so, it doesn't seem to be documented
>anywhere.  I've dug around in what passes for help in netscape's
>online documentation, of course.  Like most documentation, there's
>little if any ability to grep for topics.  If I know exactly what
>they called the thing I'm looking for, maybe I can find it.  But
>if they provided a way to edit the news header lines, they called
>it somthing that I can't guess.  My suspicion is that they didn't
>actually provide any such ability.  They know better than an idiot
>like me what the headers should look like, you know, and if I try
>to edit them, I'll just screw them up, so why should they even let
>me do such a thing?

Under the "Options" menu, "Mail and News Preferences..."
On the "Identity" tab.  I trust you can figure out which field(s)
to fill in. (Win32 Mozilla/3.0. YMMV. HTH.)

--
Ron Parker
Software Engineer
Farm Works Software       Come see us at http://www.farmworks.com


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

Date: Mon, 17 Mar 1997 10:40:28 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: John M Chambers <jc@eddie.mit.edu>
Subject: Re: AntiSPAM is as bad as SPAM
Message-Id: <332D901C.734@egames.com>

[mail&post]
John M Chambers wrote:
> Devin Ben-Hur wrote:
> > > Subject: Can you help me with this script?
> > > From: BOB <somebody@somewhere.com>
> >              ^^^^^^^^^^^^^^^^^^^^^^
> > Hey, BOB!
> > If you're going to partake of this public
> > resource for free help and advise, please be a
> > good citizen and use a real email address in your
> > postings.

> Well, now; this isn't necessarily something that users have a whole
> lotta choice over.  If I were posting this followup (I hope it's a

OK, perhaps a few users are hosed by their own environments.
BOB above doesn't look like someone trapped by their own 
crufty gateway, but like someone intentionally anonymizing 
their email address to avoid getting spammed.

Certainly addresses of the form <me@myhome.nospam.com> aren't
doing this because they can't set their headers correctly.
They're doing it because our inconvenience and exasperation
is less important then theirs.

> Why not?  Well, to start with, I'm working behind a firewall.  The
> only tool that seems to be able to even see usenet here, much less
> generate followups, is netscape.  It did pop up this nice-looking
> window, but there is no place visible that holds the headers, and
> it seems pretty clear that I won't have any say in what they will
> be.  I can edit exactly two mail header lines, the Newsgroups: and
> Subject: lines.  I can pretty much guarantee that any email reply
> to this message will bounce, and there just ain't a damned thing
> I can do to fix it.

Actually, there are a couple ways to edit your
headers in Netscape, and it wouldn't take more than
a minute or two of poking around in the menus to
find them.
>From the mail/post composition windows, try the View
menu -- which has a bunch of check-marked items
controlling which header lines get exposed and editable
in the main window (Reply-to is one of the options).
You can set the default from/reply-to address for
netscape using /Options/Mail&NewsPrefs... and the
Identity tab.

This thread has nothing to do with Perl anymore
and I'm not sure where it should go, so I'm just going
to shut up now.

--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks"  O-
    -- Sonia Orin Lyris




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

Date: Mon, 17 Mar 1997 22:24:21 GMT
From: dan@gulch.demon.co.uk (Dan Sumption)
Subject: Assorted Perl (html parsing) questions
Message-Id: <332dc452.10453140@news.demon.co.uk>

Hi. I hope someone can help me - I have just embarked on a task
which seems to grow more mammoth every time I think about it. Fed
up with the hassles of writing different netscape/explorer
versions of pages and updating navigation aids throughout a
website, I decided to write a perl script to process each page
served before the user gets to see it. However, I've got a
growing list of questions. I apologise if this post turns into
something of a ramble, but I don't even have some of the problems
very clear in my mind.

Firstly, if anyone has written or knows of any similar scripts
which I can pillage for ideas, I'd be grateful for the code or
URL.

Secondly, I'm thinking of doing all sorts of things with tags -
like check all anchor tags to see if they're local, and if so
then make the path to the file absolute and add a reference to
the script at the beginning with variables passed at the end
(e.g. <A HREF="index.html"> becomes <A
HREF="/cgi/thisscript.pl/index.html?site=lite">. I can do a quick
and dirty version of this, but would like to know if anyone has
any ideas on how to make the code as reuseable as possible, so
that I can pull a named value from any tag, alter it if
necessary, and re-insert the altered tag into the code to be
output. The code would have to be as bullet-proof as possible -
accepting values either inside or out of quotes (and allowing
spaces inside quotes), allowing spaces and newlines at any point
within the tag, etc.

Another thing I plan to do is add my own tags to the html,
something like <BROWSER TYPE="ie" VER="3" SITE="deluxe">. This
seems to create the problem that either I slurp the whole html
file into one string so that I can catch the BROWSER open and
close tags plus anything in between in one regexp, or I run
through the code line by line, setting a flag once I enter a
BROWSER tag, checking for stuff on the end of the line with the
<BROWSER> tag and the beginning of the line with </BROWSER>, etc.
- which is all possible but a little messy. Does anyone have any
ideas/suggestions.

Also on the subject of slurping, if I am checking for BROWSER
tags (and adding or ignoring the stuff enclosed by the tags) as
well as checking and changing anchor tags and possibly others,
again it starts to look like my best option is to do all
operations on one big string, so that I can use global regexp's.
Does anyone have any comments on this or alternative methods, or
on how much it is likely to affect a server's performance if it
has to run a separate perl session slurping up 5-10k files for
each page on the site accessed.

I'm sure this won't be the end of my questions on this one - but
if anyone has any ideas which may possibly help me for now, I'd
be very grateful.



-------------------------------------------------------------------
Dan Sumption :                                dan@gulch.demon.co.uk
Hard Media, London SE1                            dan@hardnet.co.uk

               -------Yell/.net award winners-------

Home (meow!): http://www.hardnet.co.uk/dan/
Work (mooo!): http://www.hardnet.co.uk/


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

Date: Mon, 17 Mar 1997 19:16:25 +0000
From: Stuart Wildish <swildish@pine.shu.ac.uk>
Subject: Can't open file
Message-Id: <332D9889.4BB5@pine.shu.ac.uk>

hullo folks

I've got this script that, well, it's going to do lots of stuff, but at
the moment I can't even get it to open a file. Here's the relevent code
:

#!/usr/local/bin/perl

$database_filename = "/usr/local/httpd/cgi-bin/mploy-database.txt";

print "Content-type: text/plain", "\n\n";

if ( defined ($database_filename) && (-e $database_filename) ) {
	print "Datafile defined and exists.", "\n";
} else {
	print "Bollocks!", "\n";
}

if ($FORM{for}) {
	print "You put: ", $FORM{for}, "\n";

	&search();
	
} 

exit(0);

sub search
{
	open (FILE, $database_location) || print "can't open sodding file";
	
	while (<FILE>) {
		print "hello!", "\n";
		
	}

	close (FILE);
}

I can't see what's wrong with it at all, so any help would be much
appreciated (sp?)

Stu

--
swildish@pine.shu.ac.uk      stu@oook1.demon.co.uk


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

Date: Mon, 17 Mar 1997 19:38:16 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: getting IP address with gethostbyaddr ?
Message-Id: <E77D7t.Jx9@bcstec.ca.boeing.com>

In article <332D6E01.446B@esbs.u-strasbg.fr>,
Ling  <ling@esbs.u-strasbg.fr> wrote:
>Hi,
>
>Does somebody show me an example of querying an IP name address knowing
>the IP dotted address.
>
>I tried th following, but something is wrong, maybe syntax or more ...?
>
>
>
>$addr=pack('C4',130,79,76,22);
>($name,$aliases,$addrtype,$length,@addrs)=gethostbyaddr($addr,AF_INET);
>

Did you perhaps forget to include Socket.pm...?

  use Socket;
  .... 


HTH,

--
Charles DeRykus
ced@carios2.ca.boeing.com


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

Date: Mon, 17 Mar 1997 15:32:39 -0500
From: Loring Millin <millin@eij.gsfc.nasa.gov>
Subject: HELP Linking Hash table to DBM database
Message-Id: <332DAA66.6CEE@eij.gsfc.nasa.gov>

I am trying to link a hash table with fields of  many sorts to a DBM
database.  The hash table consists of three string fields and an array
for the fourth field.  I am currently using several DBM database with
cross referencing in order to simulate a structure.

Any assistance that you can provide will be greatly appreciated.

-- 
=======================================
# Loring C.C. Millin                                                   
# Earth Interactions Electronic Journal    
# http://EarthInteractions.org/            
# e-mail: millin@eosdata.gsfc.nasa.gov     
#voice:  (301) 614-5282                    
=======================================
# Somewhere between boredom            
# and Insanity, lies the                                               
#    Solution...                                                       
#             Sho Khan                                                 
=======================================


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

Date: Mon, 17 Mar 1997 12:56:20 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help needed with time and Perl
Message-Id: <k44kg5.7l2.ln@localhost>

Chris Burge (gooseman@mindspring.com) wrote:
: Well the first time I didn't post the code bc the code is really bad. 
: I'm new to PERL.  But here it is, you asked for it :).  To explain it,
: I'm trying to add a changing picture to my poalrity.shtml page that
: already has a counter.  It compiles right but the page has an error in
: executing it.


: #!/usr/bin/perl

: alarm(600);

: $HOME=(getpwnam("www03748"))[7];

: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

: if ($hour==7) {

: 	open (FILE,">http://www.panoptica.com/polarity\.shtml");
: 	print FILE "<html>/n";
: 	print FILE "[<img src=\"http://www.panoptica.com/thinker1.jpg\">]\n";
: 	close (FILE);

: }

: if ($hour==12) {

: 	open (FILE,">http://www.panoptica.com/polarity\.shtml");
: 	print FILE "<html>/n";
: 	print FILE "[<img src=\"http://www.panoptica.com/thinker2.jpg\">]\n";
: 	close (FILE);

: }

: if ($hour==18) {

: 	open (FILE,">http://www.panoptica.com/polarity\.shtml");
: 	print FILE "<html>/n";
: 	print FILE "[<img src=\"http://www.panoptica.com/thinker3.jpg\">]\n";
: 	close (FILE);

: }


There are only three hours during the day when one of the "if"s will
be true. The other 21 hours, no output will be generated!

You should change them to ranges so that _any_ time will hit one
of the ranges. Something like:

if ( ($hour >= 7) && ($hour < 12) ) {

}
if ( ($hour >= 12) && ($hour < 18) ) {

}
 ...


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


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

Date: Mon, 17 Mar 1997 13:59:21 -0600
From: Eric Johnson <johnsone@camax.com>
To: smr@servtech.com
Subject: Re: Help w/Perl5 & Cross Platfomr Perl
Message-Id: <332DA299.140A@camax.com>

Steve Rogers wrote:
> 
> I just got a book "Cross Platform Perl" which says
> it covers Perl5.  I have Windows95.  It came with a
> CD and the book says the CD contains the binary version of
> Perl for Windows 95 and NT.
> 
> I tried to install.
> 
> First problem.  It said to unzip the zip file in the
> CD into a directory called \perl, so I did.
> 
> In the \perl directory that got created there was
> a \perl5 directory with branches from there.  I assumed
> some documentation was wrong, so I deleted the directory
> and unzipped into the root, which made a \perl5 directory
> tree.
> 
> Then it says to run install.bat.  When I do, It gets partway
> through the install.bat script and then complains that it can't
> find install.bat.  I've tried everyting.
> 
> 1.  Can anyone suggest how I could get Perl5 for Win32 on my
> Win 95 system from this CD?
> 
> 2.  Can anyone suggest how I could get Perl5 for Windows 95
> from the web?
> 
> I want to start learning Perl.

As the author of Cross-Platform Perl, I hope this helps. My web page,
listed below and on page 9 of Cross-Platform Perl, contains
links to acquire the latest and greatest Perl for Win32.

Good luck,
-Eric


Installing Perl on Windows 95.

Perl for Win32 doesn't install properly on Windows 95, because the
DOS batch files created by pl2bat.bat fail on Windows 95. This is caused
by the 16-bit command.com on Windows 95 as opposed to the 32-bit cmd.exe
on Windows NT.

To get around this, you can do one of two things:
* Copy files manually.
* Edit the Windows 95 Registry, as described in the Perl for
Win32 instructions.

Here's how I successfully installed Perl for Win32 on Windows 95.

* Copy the file 107-I86.ZIP file from the CD-ROM that comes
with Cross-Platform Perl to the root directory, e.g., C:\.
* Uncompress the 107-I86.ZIP file with WinZip or PKZip.
This will create a \perl5 directory and fill the directory with the
Perl for Win32 files. (I renamed this from \perl5 to \perl, just
because the Perl for Win32 installation notes claim the only
supported directory is \perl, even though this doesn't seem to
be true.)
* Change to the \perl (or \perl5) directory.
Execute install.bat. It fails, but does copy some files
into the current directory.
* Copy all the .EXE, .DLL and .BAT files in the \perl (or \perl5)
directory into \perl\bin (or \perl5\bin). You may need to create
the \perl\bin (or \perl5\bin) directory.

* Add \perl\bin (or \perl5\bin) to your PATH.

Perl should now run fine, with the caveat that batch files created
with pl2bat.bat fail on Windows 95.

You can also try the instructions below, from the file WIN95.TXT that
comes with this version of Perl. I haven't tried it yet.

>From WIN95.TXT:

Notes for Windows '95 Users

Build 105:


Most of the compatibility problems that occured in previous builds are
due to the 16-bit shell (COMMAND.COM) use on Win95. (The problems
included pipes and shell escapes).

To fix the shell problems, we have shipped a 32-bit shell wrapper
with perl-win32.You can also configure perl to use another shell
if you like.

To change the shell setting you must edit the registry.

The string:
  HKEY_LOCAL_MACHINE\Software\Microsoft\Resource Kit\PERL5\WIN95SHELL

  must be set to the full path your shell.


Build 104:
----------

Windows NT Perl was developed for Windows NT 3.51, and should run on
Windows 95. However, NT Perl has not been tested extensively under
Windows
95. The following problems have been encountered:

- Pipes don't work properly.
- The system command will not accept multiple arguments.
- GetHostByName is busted.
- Windows95 Exception handling doesn't appear to work.
  Shows up when the -v option is used.




-- 
Eric Foster-Johnson http://ourworld.compuserve.com/homepages/efjohnson/
CAMAX, SDRC's CAM Business
7851 Metro Parkway         phone: +1 612 854 5300 fax: +1 612 854 6644
Minneapolis, MN 55425 USA  johnsone@camax.com


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

Date: Mon, 17 Mar 1997 14:34:46 -0600
From: "M. Wick" <mwick@toy.mem.ti.com>
Subject: Help with Pattern Matching
Message-Id: <332DAAE6.4F14@toy.mem.ti.com>

I've tried grep, index, and the matching sequence and nothing seems to
be working.  I'm opening a file, reading in a line, and trying to
match a pattern from within the line.  I have found that I can match
the line if the parameter starts at the beginning on the line.  I want
to find the pattern in the middle of the line, and nothing seems to be
working correctly.

while( <FILE> ){
  if ( (index($_, $pattern)) >= 0 ) {

  if (grep($pattern, $_) != 0) {  (even though grep works on an array,
                                   I still tried it)

  if (/$pattern/) {               (matching on the $_ from the file)
       do this stuff if match;
  }
}

I've tried all 3 possibilities.

Here are the lines that I'm looking at:

NAME                                 <-- Works fine here
<LI><A HREF="http://..../">NAME</A>  <-- Doesn't match this line

I'm trying to find NAME.  Any suggestions?
Thanks in advance.


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

Date: Mon, 17 Mar 1997 19:14:17 GMT
From: steve@golf.com (Steven Sajous)
Subject: Re: HELP: delete and chmod file with perl
Message-Id: <332d972f.4070448@news1.alterdial.uu.net>

You can use require "COMMAND";
for both tasks, e.g:
require "rm *.htm";
require "chmod +x *.pl";

On Sat, 15 Mar 1997 15:44:26 +0000, george <jalbertl@ere.umontreal.ca>
wrote:

>I need some help...
>
>How I should do to make my perl script to delete a file (like the rm 
>command) and how I could make my script to chmod a file.
>
>Thanks in advance,
>
>George.



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

Date: Mon, 17 Mar 1997 19:18:31 GMT
From: steve@golf.com (Steven Sajous)
Subject: Re: How to sort?
Message-Id: <332d985f.4374501@news1.alterdial.uu.net>

open(FILE,"flie") || die "Could not open file :$!";
while(<FILE>)  {
$_ =~ s/=/.../g;
print $_;
close(FILE);
}
On 15 Mar 1997 17:49:26 GMT, martig@cam.org (Georges Martineau) wrote:

>I have the following data(data file):
>   John=17
>   Peter=25
>   Fred=10
>   Andrew=7
>I would like to get:
>   Peter...25
>    John...17
>    Fred...10
>   Andrew...7
>What would be the Perl script(Content-type:text/html)
>



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

Date: Mon, 17 Mar 1997 20:25:18 +0000
From: Brandt Dainow <bd@internet-etc.com>
Subject: Re: learning perl
Message-Id: <332DA8AE.5E35@internet-etc.com>

The best starting point is http://www.cis.ufl.edu/perl/ - the University
of Florida Perl Archive.  There is no substitute....

Brandt Dainow
http://www.internet-etc.com


> sean (henriques@pobox.com) wrote:
> : any suggestions on how a newbie can painlessly pickup the basics of
> : perl?? Perhaps an online tutorial ??
> :
> : thanks in advance
> :
> : pls. respond to mailto://henriques@pobox.com


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

Date: Mon, 17 Mar 1997 13:15:34 -0600
From: Daneshjoo <eermmb@engunx.unl.edu>
Subject: Need help to run two perl programs
Message-Id: <Pine.OSF.3.91.970317124930.12945A-100000@engunx.unl.edu>

Hi :

	I have the following two programs : "waitfor" and "loginfinder", 
that I have found from the Net.  Both are supposed to let you know when a 
friend or any one else whom you define, logs on to their account, by 
poping up a message on the screen.  Now, the problem is :

1) for "waitfor" the FAQ mentioned that it is possible to put more than 
one users information in the values, but I tried a couple of different 
methods and it kept checking either the first value or the last one, not 
the whole thing.  For example, if I had defined users "1@edu", "2@edu" 
and "3@edu", it would either lock on "1@edu" and keep checking that 
account or for other combinations, just check "3@edu".  The way I found 
out was that I had defined three account that are always logged on during 
the day, so the message poping up was indicating one of the three 
accounts is logged on and the rest is not, but by using the ordinary 
"finger" command, all three were logged on.  So, could any one help me 
out and show me how can I use this program to apply for multiple accounts.

	Here is the "waitfor" program :


******************************* waitfor.pl ******************************

chop($my_tty = `tty`);
chop($my_site = `hostname`);
$port = 79;		     # finger/tcp port
$sleep_time = 15;            # time to sleep between each finger
$them = 'cjm';              # user to finger
$their_name = "Chris";        # The name you want to see when your paged
$their_site = 'dunno.edu';
$sockaddr   = 'S n a4 x8';
$AF_INET = 2;
$SOCK_STREAM = 1;

($name, $aliases, $proto) = getprotobyname('tcp');
($name, $aliases, $port) = getservbyname($port, 'tcp') unless $port =~ /^\d+$/;;
($name, $aliases, $type, $len, $thisaddr) = gethostbyname($my_site);
($name, $aliases, $type, $len, $thataddr) = gethostbyname($their_site);
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);

while (1) {
    $my_ppid = getppid(); $their_on = 0;
    if ($my_ppid == 1) { die "horribly"; } # Dont run if init is my parent
    die $! unless socket(S, $AF_INET, $SOCK_STREAM, $proto); # Make socket fd
    die $! unless bind(S, $this);    # Give the socket an address
    die $! unless connect(S, $that); # Call up the remote host
    select (S); $| = 1; select (STDOUT);# Set the socket to be command buffered
    print S "$them\n";               # Tell the remote daemon the user you want
    while (<S>) {                    # While the remote daemon is sending info
        if (/Login name: $them/) {   # Read until the user you want appears
            do { $trash = <S>; } until $trash =~ /Directory/;
            chop($their_finger = <S>); # Read the line we want
            if ($their_finger =~ /On since/i) { $their_on = 1; }
            @trash = <S>;             # Black hole the rest of the info.
        }
    }
    if ($their_on) {                 # Page me lots :)
        open(MYTTY, ">$my_tty");
        print(MYTTY "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
        print(MYTTY "$their_name is on $their_site\n");
        print(MYTTY "$their_finger\n");
        print(MYTTY "\n\n\n\n\n\n\n");
        close(MYTTY);
    }
    sleep $sleep_time;
}


**********************************************************************


2) For "loginfinder", I just understand some of the command lines and 
what they do.  But the others, I have no idea, and especially, when I 
looked at the perl man pages, I couldn't find any thing for the 
"smbclient".  I tried to modify this for my account, but I keep getting 
error messages.  Most of them is about the "smbclient".  So, could some one 
please explain what each line does so maybe I can re-arrange it for my 
account, or do you think I have to add more commands to make it work for 
me.   Here is the file :


*********************************** loginfinder **************************

@logins=("1\@edu","2\@edu","3\@edu");
for ($goer=0;$goer < @logins;$goer++)
{       
	($user,$host)=split(/\@/,$logins[$goer]);
	$finger_all=`finger \@$host`;

	if("$finger_all" =~ /$user/)
        {
	$var = "/tmp/loginfinder.$$";
	open(file,">$var");
	print file $user;
	print file `cat ~/mesg`;
	close file;
	`smbclient -M eermmb <$var`;
	unlink $var; 
        }

}

************************************************************************


	Thank you for your help and time.



				Daneshjoo


			



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

Date: 17 Mar 1997 22:20:18 GMT
From: zgeist@ee.net (Unknown)
Subject: Newbie Perl question
Message-Id: <5gkg32$75o@news1.ee.net>



Greetings all -

I am trying to run an SQL script via my Perl script but it does not
seem to be working.  I started out using the MAIL example in the Learning 
Perl book (pg 23) using "open" and "print", but that is not working.
I have something along the lines of

open (ORASTUFF,"|sqlplus username/password ");
print ORASTUFF "\@test.sql\n";
close (ORASTUFF);


I did get it to work by using the following:

$dummy = `sqlplus username/password < test.sql `;
print "Dummy is $dummy";

Yeah, I know this is horrible,  but I cannot get the filehandle to work
properly above.

If you can point me to a more detailed part of either volume of 
"Programming Perl" or "Learning PERl" that would be great.

We are running 5.003 on a Perl Digital Unix box.


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

Date: 17 Mar 1997 22:23:12 GMT
From: zgeist@ee.net (Unknown)
Subject: Re: Newbie Perl question
Message-Id: <5gkg8g$75o@news1.ee.net>

Unknown (zgeist@ee.net) wrote:


* my stuff snipped *

Umm, sorry people.  My netiquette took a leave of absence.
Am I posting this in the right NG or should it be in c.l.p ?

Thanks in advance !!

Brett C.
zgeist@ee.net
Just Another Perl Newbie



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

Date: 17 Mar 1997 20:07:14 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: perl -w
Message-Id: <5gk89i$dv7@news-central.tiac.net>

In article <332D7A7A.33E7@Eng.Sun.COM>, Rick Tan  <rick.tan@Eng.Sun.COM> wrote:

>What does the following message telling me?
>
>  Use of uninitialized value at ./craid.GOOD line 432, <INPUT> chunk 1.
>
>In my Perl script, I have the following:
>
>  open (INPUT, "somefile");

You might want to say something like

  $someFile = 'somefile';
  open (INPUT, "<$someFile") || die "$0: can't open '$someFile' to read ($!)\n";

to make sure that the open succeeds or why it fails.

>  while (chop($line=<INPUT>) {  ===> line 432

There seems to be an imbalance of the parentheses here, and be aware that
chop returns the character it chops off its argument (and if the file
isn't open or you've hit end of file then it might not be defined...) so
you might want to say

  while (<INPUT>) {		# get next record into $_
    chop ($line = $_);		# assign to $line and chop off last character

    ...
  }

If you're using perl 4.xxx then consider upgrading to the latest 5
(5.003_93 which is 5.004 beta, maybe) as chop is pretty indiscriminate
about what it removes.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 17 Mar 1997 21:31:35 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Perl Compiler
Message-Id: <E77IGo.2y@presby.edu>

 Steven Sajous <steve@golf.com> wrote:
>Does anyone know where I can find a Perl compiler, and have any
>instr5uctions on how to use one?

See the FAQ at http://www.perl.com/faq/.

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
[for beginner's Usenet info, see http://web.presby.edu/~jtbell/usenet/ ]


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

Date: Mon, 17 Mar 1997 15:48:23 -0700
From: "Jon T. Day" <jday@msmailgw.sdsmt.edu>
Subject: Re: Perl Compiler
Message-Id: <332DCA37.4D8D@msmailgw.sdsmt.edu>

> Does anyone know where I can find a Perl compiler, and have any
> instr5uctions on how to use one?

I just found it a few minutes ago:
http://www.perl.com/perl/info/software.html

there's a link to CPAN with source,etc.
it's only an alpha, good luck

Jon


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

Date: Mon, 17 Mar 1997 18:20:31 +0100
From: Fredrik Lindberg <flg@vhojd.skovde.se>
To: Jonathan Tracey <jont@uunet.pipex.com>
Subject: Re: Perl for NT ***Help****
Message-Id: <332D7D5F.2C0D@vhojd.skovde.se>

Jonathan Tracey wrote: 
> How can I stop the Perl window closing as soon as it encounters an error. I
> cannot read the error messages as the windows closes like lightning.
> 
> Any help would be appreciated.

Can't you just run the script from the command line? Ie
do a perl -c scriptname in a DOS window (where -c instructs
the Perl intepreter to simply "compile" the script but
not run it (although BEGIN and END blocks are executed))

/Fredrik


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

Date: 17 Mar 1997 21:43:01 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl5.003 3x memory inefficient, Perl4.003 better?
Message-Id: <5gkdt5$nsc$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Eric Arnold
<eric.arnold@sun.com>],
who wrote in article <ERIC.97Mar16072019@m-e-ir1.sun.com>:
> 
> No I didn't have my numbers switched, but it is because I was compiling
> with Perl's malloc (I recompiled Perl5.003 with the system malloc, and it
> used an appropriate amount of memory).  It sounds like it would be good
> to be using Perl's malloc in Perl5.004 for the new enhancements, but ...

Perl's malloc will not (ever?) be able to give you 10M in your
situation, 32M looks pretty reasonable to me (16M for your string, and
the same for the trail of remaining buckets).

In fact no portable malloc may be expected to grow the string in place
indefinitely, it needs a lot of knowledge about your operating
system. Hmm, on the other hand, some optimizations people want to see
in Perl's malloc (fewer sbrk()s) may make it feasible...
Interesting...

Consider it as a bug in your algorithm PLUS Perl's malloc. :-(

Ilya


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

Date: 17 Mar 1997 21:50:31 GMT
From: ttran@simba.micro.ti.com (Tan B Tran)
Subject: Setting PATH env. variable problem...
Message-Id: <5gkeb7$rk1$1@tilde.csc.ti.com>

Hi,

I run into a strange problem which has gotten me stumped:

I have a perl code which forks into a child process. Inside this child process, I add one path
into the $ENV{PATH} env. variable by concatenating it (ie. $ENV{PATH} = "$ENV{PATH}:$newpath";)
I have no problem with this command. However, when this process in turns forks another child,
I do not see this new path reflected because when I run a which command, it returns an error
message saying such and such a command is not found in the various path directories in $ENV{PATH}.

Has anyone seen this problem before ?
--
+-----------------------+-----------------------------------------------+
|  Tan Tran, MEE, P.E.  |  Disclaimer:                                  |
|  Texas Instruments    |  Opinions expressed are mine and in no way    |
|  ttran@micro.ti.com   |  reflect those of my employers.               |
+-----------------------+-----------------------------------------------+


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

Date: Mon, 17 Mar 1997 21:06:41 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: term 'regular expressions' considered undesirable
Message-Id: <E77HB5.7Bp@nonexistent.com>

On 15 Mar 1997 15:21:22 GMT, John Kodis wrote in comp.lang.perl.misc:
++ Previously, Rahul Dhesi wrote:
++ 
++ >The ? suffix in perl5, which causes quantifiers to become non-greedy,
++ >help bring perl paterns close to real regular expressions.
++ >
++ >   /a.*b.*c/	# greedy, needs backtracking, slow, not regular expression
++ >   /a.*?b.*?c/  # non-greedy, no backtracking, fast, regular expression
++ >
++ >Perhaps it's now too late, and we need to find a new term for what
++ >we used to call regular expressions.
++ 
++ My understanding is that both of the examples above are regular
++ expressions.  Regular expressions are capable of supporting r* (Kleen
++ closures), r+ (positive closures), and r? (whatever this is called).
++ 
++ As far as I know, the only non-regular features of Perl regular
++ expressions is the ability to back-reference a previous match using
++ the \1 and related patterns.  This back-referencing ability allows
++ Perl regular expressions to recognise balanced and nested constructs,
++ two of the classic ``no can do'' types of patterns that can only be
++ expressed in a context-free or more powerful grammer.

I do not think the look-a-head assertions are regular. I would be
surprised if they are. AFAIK the class of "all languages minus a
regular one" isn't regular, and you can describe that language with
/^(?!$regex$)/. (You can do intersection and subtraction of RE's
with look-a-head too.)



Abigail



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

Date: Mon, 17 Mar 1997 14:27:59 -0600
From: Eric Johnson <johnsone@camax.com>
To: hanklem@ibm.net
Subject: Re: What's a good Perl book?
Message-Id: <332DA94F.3789@camax.com>

Hank LeMieux wrote:
> 
> David,
> 
> I have "Cross-platform Perl" and it is not a bad book.  Very well
> organized.  Very easy to find what you're looking for.  Beats the hell
> out of finding your answer on the web.
> 
> However, I also find it frustratingly uncomprehensive.  For instance,
> this is almost a direct quote: "Perl offers scads of ways to do X . . ."
> then it only tells you about 1 way to do it.  If that way is, for some
> reason, not appropriate to your situation, you're left asking, "Then why
> the heck did I buy this book?"  That can drive you up a wall.
> 
> But I will say that I am glad I bought it.
> 
> Good luck,
> 
Hank,

As the author of Cross-Platform Perl, I'd like to say
thanks--I think. I never intended to frustrate anyone!

Cross-Platform Perl is a tutorial. It is not a Perl
reference, so it does not cover all aspects of the
language. 

The purpose is to get you started with Perl (on UNIX
and Windows 95/NT). Once you've picked up the Perl basics,
you're ready to go on to the vast amounts of reference
material available on Perl. That's why the first chapter,
for example, covers how to use the Perl man pages (HTML
files for Windows users).

If you have any questions, please send me a note.

Have fun,
-Eric

-- 
Eric Foster-Johnson http://ourworld.compuserve.com/homepages/efjohnson/
CAMAX, SDRC's CAM Business
7851 Metro Parkway         phone: +1 612 854 5300 fax: +1 612 854 6644
Minneapolis, MN 55425 USA  johnsone@camax.com


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

Date: Mon, 17 Mar 1997 19:51:47 GMT
From: ross@valnet.es (Ross Howard)
Subject: Re: What's wrong with "an email" (was: How to spam - legitimately)
Message-Id: <5gk7om$cjt$1@diana.ibernet.es>

ross@valnet.es (Ross Howard) wrote:

>>>(It's the a.u.e. equivalent of Murphy's Law: "The vehemence of your
>>>bitching about the language proficiency of others is in direct
>>>proportion to the probability that in so doing you will royally screw
>>>up and make a right prat of yourself.")

> [...]comerades [...]

As I was saying...

Ross Howard
(Just got the namesake reference at last. It's what happens when you
kill the last para to rewrite and don't scroll down to make sure
you've zapped it all. This happens to Truly Donovan, too, so I don't
imagine I'm in much danger of being further chastised for it.)

Ross Howard





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

Date: 17 Mar 1997 21:48:20 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Why does string comparison use signed chars?
Message-Id: <5gke74$nsc$2@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Vladimir Alexiev 
<vladimir@cs.ualberta.ca>],
who wrote in article <omzpw317g6.fsf@tees.cs.ualberta.ca>:
> Is there any particular reason string comparison (cmp, lt, le, etc) uses
> signed chars? 

I think it is a bug/feature of the system call perl uses. I _think_
newer perls have a test in Configure which will substitute a
reasonable function if platform memcmp (sp?) is broken.

Try 5.004beta1.

Ilya


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

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

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