[9629] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3223 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 22 12:07:12 1998

Date: Wed, 22 Jul 98 09:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 22 Jul 1998     Volume: 8 Number: 3223

Today's topics:
    Re: (mutil level assoc arrays and dynamically created a (Greg Bacon)
        5.002 lib files? <jperkins@wtmail.wtamu.edu>
        5.004_04 and Net::FTP bug ? (Tom Gerstel)
        ANNOUNCE: Modem::Vgetty 0.01 on CPAN (Jan "Yenya" Kasprzak)
    Re: Bug in regex quantifiers? <markstang@ncgroup.com>
    Re: DBD/DBI/whatever accessing remote MS SQL-server <zenin@bawdycaste.org>
        Env Variables. <Samuel_lopez@mentorg.com>
    Re: Env Variables. <quednauf@nortel.co.uk>
    Re: Env Variables. (Larry Rosler)
    Re: GET & PUT from commandline mrauschkolb@my-dejanews.com
    Re: GET & PUT from commandline <tchrist@mox.perl.com>
    Re: HELP! How do i read a remote HTML file into a local <nguyend7@egr.msu.edu>
        Help! To capture errors... <bsadler@worldbank.org>
        Mod User Reg Hives w/ Win32 Perl <kcjones@umich.edu>
    Re: Module scope (Greg Bacon)
    Re: more perl uploading problems <nate@wavecomputers.net>
    Re: On mixing (seek/tell) and (sysopen/syswrite) <tchrist@mox.perl.com>
    Re: Perl Beautifier Home Page <zenin@bawdycaste.org>
        Please HELP.  Print problem <cooperga@cig.mot.com>
        Problem calling wgnuplot from perl on Win NT <tor@kmd.dk>
    Re: Problems with decimals in perl (Josh Kortbein)
        question about split gvacanti@my-dejanews.com
    Re: question about split <quednauf@nortel.co.uk>
    Re: question about split dave@mag-sol.com
    Re: removing a line from a textfile <tchrist@mox.perl.com>
        Serial Port <mcgillanp@mndulu.ang.af.mil>
    Re: SPLIT help please (Aaron B. Dossett)
    Re: SPLIT help please <quednauf@nortel.co.uk>
    Re: SPLIT help please (Tim Rosine)
    Re: SPLIT help please dave@mag-sol.com
    Re: system("grep edu list|wc -l>a") (Tad McClellan)
        time limit ? <kamrani@ifi.uio.no>
        what is offline mode? <gvoc@etb.bel.alcatel.be>
    Re: What's wrong? (Greg Bacon)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 22 Jul 1998 14:40:02 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: (mutil level assoc arrays and dynamically created array names via eval)
Message-Id: <6p4tk2$4gn$4@info.uah.edu>

In article <1998Jul21.214235.22118@il.us.swissbank.com>,
	neilm@il.us.swissbank.com writes:
: I'm building some assoc arrays names using eval():

To save syllables and sing praise to ye olde Berkeley Unix developers,
we just call them hashes. :-)

: foreach $cnt (1, 2, 3) {
:     foreach $type ("big", "small") {
:         eval "\$${type}Count ++";
:         eval "\$${type}Name  = \$${type}Name . 'test'";
:         foreach $myKey ("teeny", "tiny") {
:             eval "\$${type}AssocArr{$myKey} += 4" ;
:         }
:     }

This is almost never what you want to do.  It would be better to collect
your data in a hash of your own.  Something like

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

    use strict;
    use Data::Dumper;

    $Data::Dumper::Indent = 1;

    my %info;  ## for lack of a better name :-(

    foreach my $cnt (1 .. 3) {
        foreach my $type ("big", "small") {
            $info{$type}->{count}++;
            $info{$type}->{name} .= 'test';

            foreach my $key ("teeny", "tiny") {
                $info{$type}->{hash}->{$key} += 4;
            }
        }
    }

    print Dumper \%info;

which outputs

    $VAR1 = {
      'small' => {
        'name' => 'testtesttest',
        'count' => 3,
        'hash' => {
          'tiny' => 12,
          'teeny' => 12
        }
      },
      'big' => {
        'name' => 'testtesttest',
        'count' => 3,
        'hash' => {
          'tiny' => 12,
          'teeny' => 12
        }
      }
    };

The perllol and perldsc manpages are teeming with examples of creating
complex data structures like this.  You should definitely read them.

Although speed isn't really the name of the game, the above code is
almost certain to execute faster than its eval-laden cousin.

: The problem starts because $myKey ("teeny", "tiny") is a standin for the  
: real keys I need to read in from my datafile.

In general, you want to provide real code because it typically helps us
provide you with better advice.

: 	($fld1, $fld2, $fld3) = split(/  /);

You probably meant

    ($fls1, $fld2, $fld3) = split ' ';

: So... I need to cycle thru myKeys, when I don't know what the  keys are  
: (programatically speaking of course :^).

Using the above data structure, you can get the keys with

    foreach my $type (keys %info) {
        print "keys for $type\n";

        foreach my $key (keys %{ $info{$type}->{hash} }) {
            print "    $key\n";
        }
    }

: Why am I doing this? I am adding some major functionality to an existing  
: program, and much of the existing code is really the same block repeated  
: over and over, except that the array names change.

Oh.  Legacy code. :-(  Probably developed under version 4.036. :-( :-(
Probably no -w and no strict. :-( :-( :-(

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Wed, 22 Jul 1998 08:54:56 -0500
From: Justin Perkins <jperkins@wtmail.wtamu.edu>
Subject: 5.002 lib files?
Message-Id: <35B5EF2F.51F0945C@wtmail.wtamu.edu>

Is there a place that still has these? Or any lib files for Netware
Perl?

thanks
Justin



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

Date: Wed, 22 Jul 1998 15:53:10 GMT
From: tgerstel@world.std.com (Tom Gerstel)
Subject: 5.004_04 and Net::FTP bug ?
Message-Id: <EwI6sM.I1q@world.std.com>
Keywords: FTP Perl Solaris

I'm having a problem with Net::FTP and Perl 5.004_04 running
on Solaris 2.6.

Files are becoming truncated when using passive mode PUT to
another machine. ASCII conversion is not a factor as I'm 
using binary mode.

Perl 5.004_04 with Net:FTP 2.27 and 2.33 exhibits this (how much is
truncated does vary by version of Net::FTP).

Perl 5.003 with Net:FTP 2.27 and 2.33 does not have this problem.

Looking for some help here:

1. Anyone else experienced such a problem?

2. If not, I'd like suggestions on how to track this "bug" down.
Turning debug on in Net::FTP didn't yield much.

Thanks.

-tg



-- 
Tom Gerstel		tom.gerstel@turner.com
Senior Webmaster	tgerstel@world.std.com
CNN Interactive		http://cnn.com/
Bringing a world of news to the World Wide Web


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

Date: 22 Jul 1998 14:05:09 GMT
From: kas@fi.muni.cz (Jan "Yenya" Kasprzak)
Subject: ANNOUNCE: Modem::Vgetty 0.01 on CPAN
Message-Id: <6p4ril$1at$1@news.neta.com>



	Hello all,

	I have uploaded the Modem::Vgetty module to PAUSE.
It will propagate to CPAN sites soon.

  file: $CPAN/authors/id/Y/YE/YENYA/Modem-Vgetty-0.01.tar.gz
  size: 8528 bytes
   md5: 9d0196d81227744b715b06e62835775f

- -Yenya

- --------------------------------------------------
$Id: README,v 1.2 1998/07/20 15:46:55 kas Exp $

The Modem::Vgetty module is a Perl interface to the vgetty program,
which can be used for communication with the voice modems. Vgetty
is available as a part of the mgetty+senfdax package at the
following URL:

        ftp://ftp.leo.org/pub/comp/os/unix/networking/mgetty/

The module itself is available from CPAN (http://www.perl.org/cpan/).
The development versions are available in form of the CVS tree at
http://www.fi.muni.cz/~kas/vgetty/.

The module was written by Jan "Yenya" Kasprzak <kas@fi.muni.cz>.
Thanks to many people who made this possible, including, but not
limited to:

- -Marc Eberhard for creating the vgetty.
- -Jan Pazdziora for explaining me how the CPAN module can be created.

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



Version: 2.6.3i
Charset: noconv

iQCVAwUBNbRj31C2u4XTSYg5AQGJUwP/ay3Jfe82crjhfEB3fY2bCqwuf+CXaRR/
WIo8pb7lzN8ysUivdOZrKsY+oXjHAN+3i1u1hjUToJr0LyNYQ8iBjKKts94qhtWq
GQVr99jdDtspJlftBgnO/mxqBK5+IQVTwtsV4aPCHqZOAi32BIdwpTV46NgCZ8s6
ORg9a8OZ5aM=
=HzLN
-----END PGP SIGNATURE-----
--
\ Jan "Yenya" Kasprzak <kas at fi.muni.cz>       http://www.fi.muni.cz/~kas/
\\ PGP: finger kas at aisa.fi.muni.cz   0D99A7FB206605D7 8B35FCDE05B18A5E //
\\\             Czech Linux Homepage:  http://www.linux.cz/              ///
If there are race conditions in programs fix them. The "my programs suck fix
something else" mentality leads you to things like Java.         -- Alan Cox




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

Date: Wed, 22 Jul 1998 10:25:21 -0400
From: "Mark Stang" <markstang@ncgroup.com>
Subject: Re: Bug in regex quantifiers?
Message-Id: <6p4spa$t21$1@usenet1.interramp.com>


Ilya Zakharevich wrote in message
<6p2udq$7tt$1@mathserv.mps.ohio-state.edu>...

<-snip->

>which is longer, but gives better $&).



This will be added to my quotes list :-)




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

Date: 22 Jul 1998 14:57:16 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: DBD/DBI/whatever accessing remote MS SQL-server
Message-Id: <901120023.242012@thrush.omix.com>

Pinne <pinne@pegit.se> wrote:
: I'm looking for a way to access a remote MS SQL-server database on
: an NT-server from within a Perl-script running on a Unix system.
: I have been looking through the DBI/DBD and all that but not found any
: specific information on that.
: Has anyone done this, have any clues etc to share I'd be most gratefull.

	Take a look at DBD::ODBC, DBD::Sybase (Yes, the Sybase module),
	and/or maybe sybperl.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Wed, 22 Jul 1998 07:56:18 -0700
From: Samue Lopez <Samuel_lopez@mentorg.com>
Subject: Env Variables.
Message-Id: <35B5FD92.14644F4E@mentorg.com>

Hello.

The problem or question I have at the moment is this; does Perl supports
shell commands.
Meaning is there a way for perl to interpret c shell commands such as
source or setenv.
For example can I  "setenv foo 1234"  from within Perl and have this
variable visible in
the shell from which Perl was started?

Does any one know this.
Any help, suggestions would be very much appreciated.

Samuel



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

Date: Wed, 22 Jul 1998 16:01:59 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Env Variables.
Message-Id: <35B5FEE7.98138E5@nortel.co.uk>

Samue Lopez wrote:
> 
> Hello.
> For example can I  "setenv foo 1234"  from within Perl and have this
> variable visible in
> the shell from which Perl was started?

hmmm, if it would be possible, it would be quite bad. Someone else
starts my script from a shell, and I then can play around with his/her
ENV variables (Does that sound saucy?). Not nice, security-wise. And as
there is nothing quite bad about Perl, I therefore prove by the
mathematical method of negation, that it is not possible to change the
ENV stuff of the shell.

Is that true, or I am trusting Perl too much?


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Wed, 22 Jul 1998 08:42:39 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Env Variables.
Message-Id: <MPG.101fa8499ac2c174989777@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc; copy mailed to F.Quednau 
<quednauf@nortel.co.uk>.]

In article <35B5FEE7.98138E5@nortel.co.uk> on Wed, 22 Jul 1998 16:01:59 
+0100, F.Quednau <quednauf@nortel.co.uk> says...
> Samue Lopez wrote:
> > 
> > Hello.
> > For example can I  "setenv foo 1234"  from within Perl and have this
> > variable visible in
> > the shell from which Perl was started?
> 
> hmmm, if it would be possible, it would be quite bad. Someone else
> starts my script from a shell, and I then can play around with his/her
> ENV variables (Does that sound saucy?). Not nice, security-wise. And as
> there is nothing quite bad about Perl, I therefore prove by the
> mathematical method of negation, that it is not possible to change the
> ENV stuff of the shell.
> 
> Is that true, or I am trusting Perl too much?

perlfaq8: "I {changed directory, modified my environment} in a perl 
script. How come the change disappeared  when I exited the script? How do 
I get my changes to be visible?"

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


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

Date: Wed, 22 Jul 1998 12:54:01 GMT
From: mrauschkolb@my-dejanews.com
Subject: Re: GET & PUT from commandline
Message-Id: <6p4nd9$ci9$1@nnrp1.dejanews.com>

I wrote the following code that puts the arguments into an array named inputs
whether they come in as command line args, or via CGI GET or POST

That's what I use while testing cgi from the command line

Mark


#
## are there any command-line arguments?
#
if ($#ARGV != -1)
{
	print "Command-Line Arguments\n";
	@res = grep(/\?/,$ARGV[0]);
	if ($#res != -1)
	{
		print "CGI stye input\n";
#
# is "arg?arg2+part2" valid input?
# --> part2 ends up as ARGV[1]
#
		@parts = split(/[\\\?]+/,$ARGV[0]);
		foreach $arg (@parts)
		{
			$inputs{$arg} = $arg;
			printf ".....Arg number %d =>
%s\n",$ac++,$inputs{$arg};
		}
	}
	else
	{
		print "script style arguments\n";
		foreach $item (@ARGV)
		{
			$inputs{$item} = $item;
			printf ".....Arg number %d =>
%s\n",$ac++,$inputs{$item};
		}
	}
}
else
{
    print "\n";

    print "NO Command line Args\n";

    #determine the request method, make sure the data is defined in ARGV
    # and determine of the query string is defined
    if ($ENV{REQUEST_METHOD} eq 'GET' && $ENV{QUERY_STRING} ne '')
    {
        # split the query into keywords
        foreach $input (split("&",$ENV{QUERY_STRING}))
        {
            if ($input =~ /(.*)=(.*)/)
            {
                ($key,$value) = ($1, $2);
                $value =~ s/\+/ /g ; # replace "+" with " "
                # convert hex characters
                $value =~ s/%(..)/pack('c',hex($1))/eg;
                $inputs{$key} = $value; # add keyword/value pair to a list
            }
        }

        foreach $item (keys %inputs)
        {
	    printf ".....Arg number %d => key = %s\n",$ac,$item;
	    printf ".....Arg number %d => val = %s\n",$ac,$inputs{$item};
            print "[$item] [$inputs{$item}]\n";
	    $ac++;
        }
    }
    else
    {
	print "$ENV{REQUEST_METHOD} $ENV{CONTENT_LENGTH}\n";
	if ($ENV{REQUEST_METHOD} eq "POST")
	{
    	    print "Checking STDIN\n";
            @data = <STDIN>;
	    foreach $line (@data)
            {
		chomp($line);
                print "STDIN: -->[$line]<---\n";
                foreach $input (split("&",$line))
                {
                    if ($input =~ /(.*)=(.*)/)
                    {
                        ($key,$value) = ($1, $2);
                        $value =~ s/\+/ /g ; # replace "+" with " "
                        # convert hex characters
                        $value =~ s/%(..)/pack('c',hex($1))/eg;
                        $inputs{$key} = $value; # add keyword/value pair to a
list
                    }
                }
	    }

            foreach $item (keys %inputs)
            {
       	        printf ".....Arg number %d => key = %s\n",$ac,$item;
       	        printf ".....Arg number %d => val = %s\n",$ac,$inputs{$item};
                print "[$item] [$inputs{$item}]\n";
    	        $ac++;
            }
        }
        else
        {
            print "No inputs\n";
        }
    }
}

In article <35B50DA8.6CCF4FAF@dsccc.com>,
  JLEHMANN <JLEHMANN@dsccc.com> wrote:
> In win95, how can you pass GET and PUT information to your perl script
> for testing?  For instance, I'd like to be able to simulate "perl
> login.pl?newuser".
>
> Thanks,
> John
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 22 Jul 1998 13:15:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: GET & PUT from commandline
Message-Id: <6p4okk$grt$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    mrauschkolb@my-dejanews.com writes:
:I wrote the following code that puts the arguments into an array named inputs
:whether they come in as command line args, or via CGI GET or POST
:
:That's what I use while testing cgi from the command line

Waste of time.  CGI.pm does it virtually infinitely better, 
and with just one line of code.

--tom
-- 
150 years ago everybody was a Christian Scientist.   --dmr


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

Date: 22 Jul 1998 15:04:49 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: HELP! How do i read a remote HTML file into a local variable?
Message-Id: <6p4v2h$s1s$1@msunews.cl.msu.edu>

rudis <rudis@mindless.NOSPAMcom> wrote:
[snip]
First rudis.  Please don't MIME encode your post.

: I've tried replacing the local path on the open command to a remote
: URL (i.e.: open(FILE,"http://www.somehost.com/somefile.html");)), but
: that doesn't seem to work.

Your funny.  Wouldn't it be nice if you could do that, to bad you
can't.  Perl would try to find the file
"http://www.somehost.com/somefile.html" on the local disk. Their is a
very simple way. 

use LWP::Simple;
$page = get 'http://www.somehost.com/somefile.html';

-- 
Dan Nguyen                         |
nguyend7@cse.msu.edu               |   I am Grey.
http://www.cps.msu.edu/~nguyend7   |   


















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

Date: Wed, 22 Jul 1998 11:27:04 -0400
From: Robert Sadler <bsadler@worldbank.org>
Subject: Help! To capture errors...
Message-Id: <35B604C8.E97344B2@worldbank.org>

I am having a problem with a Perl script that has been working just fine
on one NT server for quite a while.   I am a Perl novice and this script
was left to me by a predacessor.

The script basicaly calls a backup utility,  scans the log file and then
uses a 3rd party SMTP mail program to send errors to interested
parties.  It runs in batch.   When I copied the script and all the
necessary components onto another server in the same NT domain,  it
performs the backup but will not send the mail.   The same job, run
under the same username will work if run interactively, however.   I
have tried several ways to see if I could get some kind of error message
back from the call to the mail program, without success.   I believe the
offending line is this;

$Stat = open(MAIL, "|$MailCmd -- \"-s$Subject\" \"\@$ToList\"");

I have given up trying to figure out what is different between the
server it runs in batch on and the new one.  My only hope is to see if I
can capture any error generated by the mail command.  Can anyone tell me
how to do this?  I have included the full text of the Perl script
below.  This Perl newbie would appreciate any advice that could be
offered...

****************************
@BEJobs = @ARGV;
$BEProgDir = shift (@BEJobs);
$BELogDir = "${BEProgDir}\\DATA";
%BELogErrors = &LogErrors();  # See subroutine for explanation
$LogFile = "";
$ErrList = "";
$ExitStat = 0;
$MailList = "\\\\server1\\SYSPROD\$\\BackupMail.lis";
$PageList = "\\\\server1\\SYSPROD\$\\TestPage.lis";


###  If BEWINNT.EXE does not exist in the program directory listed
###  in $ARGV[0] exit with Syntax error.
if (!(-e "$BEProgDir\\BEWINNT.EXE")) {&Syntax();}


###  Execute backup jobs in order, saving the status from each
foreach $BEJob (@BEJobs) {

 ###  Command line execution of BackupExec
 print "Executing BackupExec command...\n";
 $Output = `$BEProgDir\\BEWINNT.EXE /J\:\"$BEJob\"`;

 ###  Error status from command execution returned in $?
 ###  (shifted over 8 bits)
 $BEExitStat{"$BEJob"} = ($? >> 8);

}

###  Evaluate the status retured from each backup operation,
###  and then scan logfile if there has been an error.
foreach $JobName (keys %BEExitStat) {
 if ($BEExitStat{"$JobName"}) {

  print "\n**** Error in BackupExec execution of $JobName job ****\n\n";

  local( @Files, $RefSpec, %LogFiles, @Dates, $ErrList, $LogFile, $Jnk,
$Size );

  ###  Find the correct BackupExec logfile.  The logfiles
  ###  are inspecifically named.  We do a reverse sort by
  ###  date using DIR command, and then scan file contents
  ###  for the $JobName string (the newest files are first
  ###  in the list, and are probably the correct files.)

  print "Locating $JobName job log file...\n";
  @Files = `cmd /c dir /b /o:-d $BELogDir\\*.TXT`;
  foreach $Element (@Files) {        # Loop enumerating logfiles
    local( $Stat);
   chomp $Element;                # Delete terminating hard return
   $RefSpec = (join ("\\", (split (/\\/, "$BELogDir")), "$Element"));
                                  # Combine path with filename
   open(HANDLE, "$RefSpec") or next;
   while (<HANDLE>) {             # Loop reading lines from this logfile

    if (/$JobName/i) {
     $LogFile = "$RefSpec";
     last;                  # End loop reading this logfile
    }
   }
   close( HANDLE );
   if ($LogFile) {last;}          # End loop enumerating all logfiles
  }

  ###  Parse Errors from logfile by comparing the key strings
  ###  in the BELogErrors associative array to the text of
  ###  the logfile, and then compile a short comma delimited
  ###  string listing the error values matched in BELogErrors.

  ($Jnk,$Jnk,$Jnk,$Jnk,$Jnk,$Jnk,$Jnk,$Size,$Jnk,$Jnk,$Jnk,$Jnk,$Jnk)
          = stat("$LogFile");

  ###  If the LogFile is less than 100000 bytes, scan for errors
  if ($Size < 100000) {
   print "Parsing log file $LogFile for errors...\n";
   open(ERRSCAN, "$LogFile");
   @ErrScan = <ERRSCAN>;
   close(ERRSCAN);

   ###  For each error text entry in BELogErrors, scan
   ###  contents of log for a match (case insensitive).
   foreach $ErrString (keys %BELogErrors) {
    if (grep (/$ErrString/i, @ErrScan)) {
     if ($ErrList) {$ErrList = "$ErrList, ".$BELogErrors{"$ErrString"};}

     else {$ErrList = $BELogErrors{"$ErrString"};}
    }
   }
  }
  else {
   ###  If log file is huge, skip the scan
   print "Log file $LogFile is too large to scan for errors...\n";
   @ErrScan = "Log file $LogFile is too large to scan for errors...\n";
  }

  ###  If the lines read from the LogFile are less than 400, include
text in
  ###  body text of mail message.
  if ($#ErrScan < 400)
  {
   print "Log file $LogFile is being included in text for mail
message...\n";
   push(@AllErrLog, "\n\n**** Error in BackupExec execution of $JobName
job ****\n\n");
   for (@ErrScan) {push(@AllErrLog, $_);}
  }
  else {
   print "Log file $LogFile is too large to include in mail
message...\n";
   push(@AllErrLog, "\n\n**** Error in BackupExec execution of $JobName
job ****\n\n");
   push(@AllErrLog, "Log file $LogFile is too large to include in mail
message.\n\n");

  }


  ### If $ErrList remains undefined, give it value UNKNOWN-ERROR
  if (!$ErrList) {$ErrList = "UNKNOWN-ERROR";}

  print "Log lists following error conditions for job $JobName:
$ErrList\n";

  ### Compile full list of errors for all failed jobs
  if ($AllErrList) {$AllErrList = " * $JobName: $ErrList";}
  else {$AllErrList = "$JobName: $ErrList";}

  ### Compile full list of logfiles for all failed jobs
  push(@AllLogList, $LogFile);

  $ExitStat = 1;
 }
 else {
  ###  On success, skip reading logfile
  print "BackupExec Job $JobName was successful.\n";
 }
}

if ($ExitStat) {
 ### Perform operations for backup failures

 print "Sending mail to Mailing List $MailList... \n";
 &MailTo ("BackupExec Job Failed - $AllErrList", \@AllErrLog,
"$MailList");

 # print "Sending page to pager list $PageList... \n";
 # &PageTo ("BackupExec Job Failed - $AllErrList", "$PageList");

}
else {
 ### Perform operations for successful backups

 print "Sending mail to Mailing List $MailList... \n";
 &MailTo ("BackupExec Job Successful - @BEJobs", "", "$MailList");

}

################## END OF SCRIPT

exit $ExitStat;


################## START OF SUBROUTINES
sub LogErrors {

 ###  This just sets up an associative array of
 ###  error strings that might be in the logfile
 ###  of a failed BackupExec job, and then associates
 ###  them with a brief error description code.
 ###  The strings are evaluated as regular
 ###  expressions, so you should use the appropriate
 ###  wildcards, escape codes, etc.

 local (%MyErrors);
 %MyErrors =   ( "Error! Job .* was not found", "NO-SUCH-JOB",
     "Unable to attach to", "NETWORK-SHARE-UNAVAILABLE",
     "Access denied to ", "NO-PERMISSION",
     "is a corrupt file", "CORRUPT-FILE",
     "Error. Can\s?not backup", "ERROR-OR-CONNECTION-LOST",
     "Remote ABORT request was received from", "REQUESTED-ABORT",
     "The loader option .Abort at end of group\. is set, operation
aborted", "END-OF-GROUP-ABORT",
     "The device .* is not available", "DEVICE-IN-USE",
     "Bad data", "TAPE-ERROR-BAD-DATA",
     "Hardware failure", "HARDWARE-FAILURE",
     "not a valid media in the storage device", "INVALID-MEDIA"
     );

 %MyErrors;
}

sub Syntax {

 ###  This is the error exit if invalid parameters are passed
 ###  to the script.

 print
"--------------------------------------------------------------------\n";

 print "\nThe correct syntax for the BEBackup is as follows:\n\n";
 print "    perl BEJobs.pl \"C:\\BKUPEXEC\\NT\" \"CAS_FULL_BK\"\n\n";
 print "Where \"C:\\BKUPEXEC\\NT\" is a valid BackupExec program
directory\n";
 print "on the local machine, and \"CAS_FULL_BK\" is one or more defined
\n";
 print "jobs in the BackupExec configuration.\n\n";
 print
"--------------------------------------------------------------------\n";

 die "Error- Invalid arguments\n";
}

sub MailTo {
 ###  Subroutine to send SMTP mail.  The sub
 ###  expects three parameters-- the subject
 ###  line of the message, a handle to an array
 ###  containing the body of the message, and
 ###  the path to a text file containing a list
 ###  of recipients.
 ###  EXAMPLE:
 ###    &MailTo($Subject, \@BodyText,
"\\\\server1\\SYSPROD\$\\MailList.lis");

 local ($Stat, $Subject, @Recipients, $MailCmd, $Body);

 $MailCmd = "\\\\Server2\\SYSUTIL\$\\WMAILTO.EXE";
 $Subject = shift(@_);
 $Body = shift(@_);
 $ToList = shift(@_);

 $Stat = open(MAIL, "|$MailCmd -- \"-s$Subject\" \"\@$ToList\"");
 if (!$Stat){
  print "Error processing mail message\n";
  return 0;
 }
 foreach $Line (@{$Body}) {print MAIL "$Line";}
 close(MAIL);
 1; #  Successful exit
}

sub PageTo {
 ###  This subroutine will submit a page to a specified
 ###  user.  It takes the message test as the first
 ###  parameter, and the registered eight-character
 ###  pager key for the second parameter, as in the
 ###  following:
 ###  EXAMPLE:
 ###  &PageTo("This is my message", "\\\\server1\\SYSPROD\$\\My.LIS");

 local ($Output, $Message, @Recipients, $PageList);
 $Message = shift(@_);
 $PageList = shift(@_);

 if (!(open(PAGELIS, "$PageList"))) {
  print "Error opening list of page recipients\n";
  return 0;
 }
 @Recipients = <PAGELIS>;
 close(PAGELIS);

 foreach $To (@Recipients) {
  chomp $To;
  $Output = `rsh timeshare -l beeper \@page \\\"$Message\\\" $To`;
  if ($? >>8) {print "Error sending page to $To\n";}
 }
 1; #  Successful exit
}



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

Date: Wed, 22 Jul 1998 14:43:19 GMT
From: Kevin Jones <kcjones@umich.edu>
Subject: Mod User Reg Hives w/ Win32 Perl
Message-Id: <bUmt1.4770$24.27938714@news.itd.umich.edu>

Sorry if this is a repost.  I've been having some problems with my
provider, and wasn't sure if the message had gone through.

I have version 5.00402 of the binary dist of win32 perl.  I'm trying to
open and modify a user's registry hive while logged in as a different
user.  I've tried everything I can think of, but haven't yet succeeded.

Any Ideas?
--								       
kevin jones				We are the music makers;    
kcjones@umich.edu		  We are the dreamers of dreams.       


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

Date: 22 Jul 1998 14:15:00 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Module scope
Message-Id: <6p4s54$4gn$3@info.uah.edu>

In article <6p3gf2$tii$1@nnrp1.dejanews.com>,
	livshits@acm.org writes:
: Suppose I have package Foo and I want to call a globally defined procedure
: from it. I can always do this by saying &main::proc, but is there a way to
: replace the local scope (Foo::) by main:: so that I can just say proc and it
: will look at main::proc and not Foo::proc. Hope this is not too confusing.
: Any help will be greatly appreciated. Please email.

Well, you could go about it the other way and import subs from Foo into
main's namespace.  Read the Exporter manpage for all the fun details.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Wed, 22 Jul 1998 10:07:09 -0500
From: Nathan Stitt <nate@wavecomputers.net>
To: Indra Rosadi <rosadi@students.uiuc.edu>
Subject: Re: more perl uploading problems
Message-Id: <35B6001C.361C1F7C@wavecomputers.net>

I've had great luck with using Jeffrey Carnahan's file upload script at
http://www.terminalp.com/scripts/
I'm also using cgi.pm on IIS 3 although I use Netscape 4.5 as the browser.
This really shouldn't matter if the
IE properly adheres to the file upload specs that Netscape set forth though

hope this helps,
Nathan Stitt


Indra Rosadi wrote:

> Hi,
> I keep getting trouble with perl uploading feature.. This is the
> combination that I used for my machine:
> IE 4.01
> IIS 4.0
> ActivePerl 5.00471 (by Activestate) with CGI.pm 2.42 bundled with it
>
> And it gave me this error message:
> Malformed multipart POST
>
> However, when I tried it with Netscape Navigator 4.05.. everything is
> cool (at least for the example that I used)..
>
> BTW, the code that I tried in my machine is available in:
> http://stein.cshl.org/WWW/software/CGI/examples/file_upload.txt
>
> Anybody has any suggestion on how to fix the IE 4.01 problem or upload
> problems in general?
> And one more thing, where can I download Perl 5.004+ ? (beside
> Activeperl)?
> Any comments, suggestions, helps will be appreciated..
>
> Thanks in advance..
>
> Indra



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

Date: 22 Jul 1998 12:52:37 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: On mixing (seek/tell) and (sysopen/syswrite)
Message-Id: <6p4nal$grt$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, k y n n <kj0@mailcity.com> writes:
:>:What I want to know is, what can I safely use in place of tell() and
:>:seek() in conjunction with sysopen(), syswrite()?

On some systems is makes a difference, so we added sysseek() to work
with both syswrite() and sysread().  sysseek serves for both seek and
tell purposes, returning "0 but true" as need be.  You may mix sysopen()
with normal buffered I/O, though.  In fact, you often have to.

--tom
-- 
"A ship then new they built for him/of mithril and of elven glass" 
    --Larry Wall in perl.c from the v5.0 perl distribution,
	citing Bilbo from Tolkien's LOTR


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

Date: 22 Jul 1998 15:15:59 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl Beautifier Home Page
Message-Id: <901121146.20235@thrush.omix.com>

Bart Lateur <bart.mediamind@tornado.be> wrote:
	>snip<
: > I don't think I've even seen an code editor that supported
: >	variable width fonts at all, for good reason.
: Hmmm... I've always assumed that was just pure laziness of the
: programmer. A variable pitch editor is more difficult to write.

	$ ls -l `which xemacs-19.14`
	-rwxr-xr-x  1 bin  bin  2793472 Mar 12  1997 /usr/local/bin/xemacs-19.14
	                        ^^^^^^^
	Oh, I wouldn't call them lazy.  Anyone that has the time to code
	an editor that results in a nearly 3 meg binary is already working
	to hard, IMHO. ;-)

	If variable width fonts really had a legitimate place in a code
	editor, it would have been done by now.  As far as applications
	go, I don't think there has been any wheel reinvented so many
	times as the editor.  Surely *someone* would have made a variable
	font width one at some point.

	I've got this hunch though, that durring the process of coding such
	an editor, the virtues of fixed width code probably would dawn on
	the programmer who would then simply drop the project. :-)

	Personally, I feel the font is what makes text easy to read or not.
	If it is fixed or variable width is quite secondary to the design
	of the font.  The MS Courier font is quite ugly, I agree.  I'd
	be quite surprised however, if you could not find a fixed width
	font (probably included in a real code editor) that was easier
	to read then the variable width font you're currently using.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Wed, 22 Jul 1998 09:35:57 -0500
From: "Glenn A. Cooper" <cooperga@cig.mot.com>
Subject: Please HELP.  Print problem
Message-Id: <35B5F8CC.A707F585@cig.mot.com>

I need to cat a file to a printer using the enscript -r command.  My
program sucessfully writes the information to a file and I want to
automatically send it to the printer with the above command.  It keeps
showing that there is no input.  Any help would be GREATLY appreciated.



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

Date: Wed, 22 Jul 1998 17:07:32 +0200
From: "Torfinn Keringen" <tor@kmd.dk>
Subject: Problem calling wgnuplot from perl on Win NT
Message-Id: <6p4v85$mse$1@news1.tele.dk>

Hi
What I want to do is to run a perl script who collect some data and
generates an gif file,
using wgnuplot beta 3.5 patchlevel 332

Running wgnuplot alone is no problem, it generates what I want.

But when I call gnuplot from perl the script hang, on the line where I'm
calling gnuplot from.
If I then use ctrl + D, the scripts goes on, the gif file is created, but
there is a process of gnuplot still running.

This happends when I use system("gnuplot <filename>") and `gnuplot
<filename>`.

If I'm using Win32::process::create and so on, the script doesn't hang but,
the process(gnuplot) will still be running, so if I will generates a new
file every hour, the memory is soon used with all those processes.

How can I call gnuplot from perl Win 32, so that the process dies when the
job is done????



Torfinn Keringen   -- >  tor@kmd.dk






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

Date: 22 Jul 1998 14:54:11 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Problems with decimals in perl
Message-Id: <6p4uej$rgp$1@news.iastate.edu>

Nico van Leeuwen (webmaster@acidhouse.com) wrote:
: Hi,

: I have been working on a program that is meant to show some accounting
: information. One of the operations involves the calculation of a tax
: which amounts to 12.5% of the total. Offcourse that was easy to do
: however I end up with way to many numbers after the decimal point. I
: would like there to be only 2 numbers after the decimal point, so I
: tried the following:

:  $rawgst = int $gstraw*100;
:  $gst = $rawgst/100;

: to get the decimal out, for some reason it won't do what I want. Is
: there maybe a specific function in perl for this kind of operation?

sprintf()





Josh

--

__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
            - Thomas Pynchon



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

Date: Wed, 22 Jul 1998 13:50:39 GMT
From: gvacanti@my-dejanews.com
Subject: question about split
Message-Id: <6p4qnf$gqm$1@nnrp1.dejanews.com>

>From the Camel Book (function split) I understand that in the following
example:

$a = ' a b ';
$_ = $a;
@b = split /\s+/;
@c = split;


foreach(@b){
print "-b-$_-\n";
}
foreach(@c){
print "-c-$_-\n";
}

@b and @c should be the same ("if the PATTERN is also omitted, the function
splits on white space, /\s+/, after skipping any leading whitespace"). But the
output I get is:

-b--       <-- Extra field ?
-b-a-
-b-b-
-c-a-
-c-b-


Could somebody explain what's happening? Thanks.

Giuseppe Vacanti

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 22 Jul 1998 15:56:52 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: question about split
Message-Id: <35B5FDB4.A41A3540@nortel.co.uk>

gvacanti@my-dejanews.com wrote:
> 
> @b and @c should be the same ("if the PATTERN is also omitted, the function
> splits on white space, /\s+/, after skipping any leading whitespace"). But the
> output I get is:
> 
> -b--       <-- Extra field ?
> -b-a-
> -b-b-
> -c-a-
> -c-b-
> 
> Could somebody explain what's happening? Thanks.
> 
> Giuseppe Vacanti
> 

$a = ' a b ';
$_ = $a;
@explicit = split /\s+/;
@implicit = split;


foreach(@explicit){
  print "-expl-$_-\n";
}
foreach(@implicit){
  print "-impl-$_-\n";
}

print scalar @explicit;
print scalar @implicit;

@explicit has indeed an extra field, its length is 3, while @implicit
has two. split on its own gets rid of leading whitespace completely.
Apparently the first split also splits on the first whitespace, so the
contents of the first element is ''. Does that make sense? (I don't know
:)
-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Wed, 22 Jul 1998 15:38:58 GMT
From: dave@mag-sol.com
Subject: Re: question about split
Message-Id: <6p512i$pa7$1@nnrp1.dejanews.com>

You've already explained exactly what's happening and, more importantly, why
in your post.

If the split pattern is missing, the scalar is split on /\s+/ *after skipping
any missing whitespace*. If you give it an explicit pattern of /\s+/ the
whitespace is not skipped, hence you have an extra element delimited by the
first space in $a.

hth,

Dave...

In article <6p4qnf$gqm$1@nnrp1.dejanews.com>,
  gvacanti@my-dejanews.com wrote:
> From the Camel Book (function split) I understand that in the following
> example:
>
> $a = ' a b ';
> $_ = $a;
> @b = split /\s+/;
> @c = split;
>
> foreach(@b){
> print "-b-$_-\n";
> }
> foreach(@c){
> print "-c-$_-\n";
> }
>
> @b and @c should be the same ("if the PATTERN is also omitted, the function
> splits on white space, /\s+/, after skipping any leading whitespace"). But the
> output I get is:
>
> -b--       <-- Extra field ?
> -b-a-
> -b-b-
> -c-a-
> -c-b-
>
> Could somebody explain what's happening? Thanks.
>
> Giuseppe Vacanti
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 22 Jul 1998 13:11:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: removing a line from a textfile
Message-Id: <6p4odr$grt$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    "Mathijs Oosterom" <thijs@esense.nl> writes:
:Can anybody tell me how to remove one line from a textfile with Perl? 

Question 2, perlfaq5.  read it or else.

:And
:which filehandle should I use?

Well, I like ARGVOUT, but you don't actually use it by name.
See -i.  But just read the FAQ.

--tom
-- 
    "Just because something is obviously happening doesn't mean something obvious
    is happening." --Larry Wall


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

Date: Wed, 22 Jul 1998 07:51:38 -0500
From: "Patrick L. McGillan" <mcgillanp@mndulu.ang.af.mil>
Subject: Serial Port
Message-Id: <6p4mtk$lf4368@michener.tea.state.tx.us>

Hi,

Does anyone have some examples of talking to a serial port? Best I can
figure, I should be using the comm.pl module/example. Is this correct? Any
thoughts? I need two-way!

Patrick
mcgillanp@mndulu.ang.af.mil




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

Date: 22 Jul 1998 13:30:36 GMT
From: aarond@alpha.ewl.uky.edu (Aaron B. Dossett)
Subject: Re: SPLIT help please
Message-Id: <6p4phs$m9q$1@service3.uky.edu>

horseyride@hotmail.com wrote:
> Can someone tell me how to do split commands for weird characters? 
> I have two > splits, one where I want to split on a '.' (decimal) 
> and one on a '|' (pipe character). Thanks
> 
> Adam

Well, the first argument to split is a pattern (perldoc -f split).
To use special characters in a regular expression they must be escaped
with a backslash.

@foobar = split (/\./, $foo);
@foobar = split (/\|/, $foo);


-- 
Aaron B. Dossett   |   Finger aarond@london.cslab.uky.edu for PGP key
dossett@bigfoot.com|      
Comp. Sci. Senior  |         http://www.ewl.uky.edu/~aarond
    University of Kentucky    1996 & 1998 NCAA Basketball Champions


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

Date: Wed, 22 Jul 1998 14:23:23 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: SPLIT help please
Message-Id: <35B5E7CA.EE3117C1@nortel.co.uk>

horseyride@hotmail.com wrote:
> 
> Can someone tell me how to do split commands for weird characters? 

If you take weird drugs, U can have a backflash. If you want to escape
weird characters, U can use a backslash.


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Wed, 22 Jul 1998 14:29:55 GMT
From: trosine@math.uwsuper.edu (Tim Rosine)
Subject: Re: SPLIT help please
Message-Id: <35b5f471.1895917718@news.wwa.com>

On Wed, 22 Jul 1998 12:41:53 GMT, horseyride@hotmail.com wrote:

>Can someone tell me how to do split commands for weird characters? I have two
>splits, one where I want to split on a '.' (decimal) and one on a '|' (pipe
>character). Thanks
>
>Adam

@array = split('.',$string);
@array = split('|',$string);

If you have to split the same string on BOTH characters, you could use

@array = split(/[\.\|]/,$string);

If you're trying to make a multi-dimensional array:

@temp = split('.',$string);
for ($i = 0; $i<scalar(@temp); $i++) {
    $array[$i] = split('|',$temp[$i]);
}

There may be a better way of doing this, but I can't think of it right
now.


Tim Rosine
trosine@math.uwsuper.edu


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

Date: Wed, 22 Jul 1998 14:23:29 GMT
From: dave@mag-sol.com
Subject: Re: SPLIT help please
Message-Id: <6p4sl1$je6$1@nnrp1.dejanews.com>

In article <6p4mmh$bfd$1@nnrp1.dejanews.com>,
  horseyride@hotmail.com wrote:
> Can someone tell me how to do split commands for weird characters? I have two
> splits, one where I want to split on a '.' (decimal) and one on a '|' (pipe
> character). Thanks

The first parameter to the split function (i.e. the characters to split on)
is a standard Perl regular expression. As you've spotted, both '.' and '|'
are special (or meta) characters in Perl REs.

I'd go back to reading perlre if I was you as you've obviously missed the bit
where it tells you how to quote metacharacters.

hth,

Dave...

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 22 Jul 1998 08:10:19 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: system("grep edu list|wc -l>a")
Message-Id: <rbo4p6.pv8.ln@localhost>

alexYPchiu@hotmail.com wrote:
:   I have a mailing list. And I try to calculate the number of subscribers
: in different groups, ie .edu, .com, etc. For shell, I can do it easily
: with "grep .edu LISTNAME|cw -l". But I don't know how to do it using perl.


   Don't you really mean:

     grep '\.edu$' LISTNAME | wc -l

   ???

   ( match a _literal_ dot. force the four chars to be at the end of string )




   Or do you really mean to count newsgroups such as:

      misc.education
      comp.edu.composition
      alt.airline.schedules

   ???

   Your grep above matches all of those...


:   I try something like the following, but I think it's awkward. Any
: suggestions? BTW, I tried to put the number in a file.


   Friends don't let friends use temp files (unless they are truly large)

    ;-)


: #!/usr/bin/perl

   You should always ask perl to help you find your mistakes.

   This will point out many common errors *immediately* (ie. when
   you execute the script). 

   You don't have to spend even 5 seconds peering at your code, 
   trying to find where you misspelled a variable name or something 
   similarly silly and common.

   You do it this way (as described in the 'perlrun' man page that came
   with your copy of the perl distribution):

     #!/usr/bin/perl -w
                     ^^
                     ^^  enable warning messages


   Be prepared to get finished with writing your programs in less
   time than you currently spend, should you adopt using -w on
   every one of your scripts.   ;-)



: open(FILE, ">test.html");

   You should always, yes always, check the return value from
   open() calls.

   What will your script do if you do not have write permission to
   create the file above?  What about if the file system is too full
   to support even one more file?

   (it will plow on, and none of the results will get written to the file.
    And it may not even give any output to indicate that it didn't do
    anything...
   )

   You should do it this way (other examples are given in the 
   description of the open() function in the 'perlfunc' man page 
   that came with your copy of the perl distribution):

    open(FILE, '>test.html') || die "could not open 'test.html'   $!";

      
: system("grep edu LISTNAME|wc -l>a");
: open(IN,"<a");
: $a=<IN>;
: close(IN);
: print (FILE $a);
: close(FILE);


   If you are going to go for calling system() anyway, then you 
   can get all of that with just:

      system("grep '\.edu$' LISTNAME | wc -l >test.html");     

   put it where you want to begin with   ;-)



   But why bother with going outside of perl at all?

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

$edu_cnt=0;   # haven't found any matches yet

open(IN, 'LISTNAME') || die "could not open 'LISTNAME' $!";
while (<IN>) {               # read a line
   $edu_cnt++ if /\.edu$/;   # count it if it matches
}
close(IN);

open(OUT, '>test.html') || die "could not open 'test.html' $!";
print OUT "$edu_cnt\n";
close(OUT);
-------------------



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 22 Jul 1998 16:35:25 +0200
From: Kamran Iranpour <kamrani@ifi.uio.no>
Subject: time limit ?
Message-Id: <35B5F8AD.62F0@ifi.uio.no>

Hi

How do I implement a time limit for a process to take place
 in a perl script ?
I have a list of machines that I try to start similar process
on each. These could be down or something else could be wrong.
How do I say that if the "rsh" takes say more than 10 sec, then
skip this machine and move to the next on the list ?

Thanks in advance

Kamran


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

Date: Wed, 22 Jul 1998 16:25:55 +0200
From: Gaetano Vocca <gvoc@etb.bel.alcatel.be>
Subject: what is offline mode?
Message-Id: <35B5F673.D50DE8D0@etb.bel.alcatel.be>

This is a multi-part message in MIME format.
--------------4F285C0C92C60D46290CFD27
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi all,
I'm a new Perl user enjoying the vast and "magic" Perl community. The
question I have is the typical newbie one. I would like to use the
routines of the CGI module to generate some HTML pages but not in a CGI
program. Each time I try to run my small script the Perl program prints
on STDOUT the message:
(offline mode: enter name=value pairs on standard input)
waits for a string of arguments and then it runs regularly.
Is there any way to avoid this message and the request of the arguments?

TIA
Gaetano

--------------4F285C0C92C60D46290CFD27
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Gaetano Vocca
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Gaetano Vocca
n:              Vocca;Gaetano
org:            Alcatel Italia - Battipaglia
adr:            Via Eugenio Caterina 60;;;Salerno;;84124;Italy
email;internet: gvoc@etb.bel.alcatel.be
tel;work:       +39 828 398491
tel;home:       +39 89 794142
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------4F285C0C92C60D46290CFD27--



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

Date: 22 Jul 1998 14:11:01 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: What's wrong?
Message-Id: <6p4rtl$4gn$2@info.uah.edu>

In article <35B44576.E2495697@seletar.ap.deuba.com>,
	Wilson Henriquez <henrwi00@usfca.edu> writes:
: #! /usr/bin/perl
: print ("Hello, world!\n");
: Then I save the file and do, chmod +x ex.  Next I try to run the
: exeecutable file I get the message "print not found".  What am I doing
: wrong?

It looks like your system might be handing the program off to the shell.
(You never told us--what is your platform?)  Try putting this at the top
of your program:

#!/usr/bin/perl
    eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
        if $running_under_some_shell;

For an explanation of why you might want to use this, check out

    <URL:http://www.perl.com/CPAN/doc/FMTEYEWTK/sh_dollar_at>

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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