[7589] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1215 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 22 18:07:14 1997

Date: Wed, 22 Oct 97 15:00:32 -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 Oct 1997     Volume: 8 Number: 1215

Today's topics:
     $recipient <crose@us.oracle.com>
     Re: $recipient (Faust Gertz)
     AS/400 Perl Users? <John.Allen@usa.net>
     Re: Can perl be maken to Compiler instead of interprete <Jan@chipnet.cz>
     Re: Can perl be maken to Compiler instead of interprete <zenin@best.com>
     Re: Children becoming ZOMBIE if parent still alive? (Will Morse)
     Re: Data driven code...? (Toutatis)
     Re: date in chat script (Clay Irving)
     Digital UNIX 4.0 and Perl 5.004_01 Problems? <vazquez2@ixc.net>
     Re: excel-files with perl? <Jan@chipnet.cz>
     Help with  formating text with perl (Ranson)
     Help,perl will not load Advapi32.dll on NT <adnanh@allinfosys.com>
     Re: HELP: strange problems with if () (Mike Stok)
     Re: How to go a particular line in a file? (Craig Berry)
     Internet Prgrammer Needed <mao@djembe.oit.unc.edu>
     Re: Move specified number of variables into one array?? (Toutatis)
     Re: naming variables after other variables (Jeremy D. Zawodny)
     Re: naming variables after other variables (Faust Gertz)
     Re: Newbie Question : remove files named $files (Faust Gertz)
     Re: Opening a network connected drive from dos w/ perl <patton@micro.ti.com>
     Passing Associative Arrays to a subroutine pasn@ix.netcom.com
     Re: perl + Blat on NT problem rex@atomicvision.com
     Perl for NT and ARGV parameters wilson.sinclair@dial.pipex.com
     Re: Perl5.003 source ??? (Mike Stok)
     Re: Precompiling PERL Scripts..... (Matthew Cravit)
     Re: Random number in perl. (Joel Coltoff)
     Re: Random number in perl. (Faust Gertz)
     Re: sorting code? <burleigh@hackberry.chem.niu.edu>
     Timing out sys process? <david@ipac.caltech.edu>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 22 Oct 1997 09:26:42 -0700
From: Carmen Rose <crose@us.oracle.com>
Subject: $recipient
Message-Id: <344E2942.6C9F@us.oracle.com>

Hi,

I'm trying to add another userid in the recipient string of my perl
script.  It's currently working and right now it reads:


$recipient = 'cvcinfo@us.oracle.com';

How can I add crose@us.oracle.com?

Many thanks,
Carmen


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

Date: Wed, 22 Oct 1997 19:53:55 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: $recipient
Message-Id: <34625920.6351142@news.wwa.com>

On Wed, 22 Oct 1997 09:26:42 -0700, Carmen Rose <crose@us.oracle.com>
wrote:

>I'm trying to add another userid in the recipient string of my perl
>script.  It's currently working and right now it reads:
>
>
>$recipient = 'cvcinfo@us.oracle.com';
>
>How can I add crose@us.oracle.com?

Do you mean other than bt typing the following?

$recipient = 'cvcinfo@us.oracle.com, crose@us.oracle.com';


Faust Gertz
Philosopher at Large


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

Date: 22 Oct 1997 19:30:32 GMT
From: "John D. Allen" <John.Allen@usa.net>
Subject: AS/400 Perl Users?
Message-Id: <01bcdf20$8960c7e0$c90a16ac@MIS01.obrien.com>

Before I go and re-invent several wheels, I was wondering if there are any
other AS/400 Perl users out there, and if they have already looked at File
(as in database) access?

-- John Allen


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

Date: Wed, 22 Oct 1997 21:25:07 -0700
From: Jan Krynicky <Jan@chipnet.cz>
Subject: Re: Can perl be maken to Compiler instead of interpreter?
Message-Id: <344ED1A3.30C3@chipnet.cz>

Doug Seay wrote:
> 
> [posted and mailed]
> 
> www wrote:
> >
> > hi all,
> >
> >        I have perl interpreter. I want a perl compiler to compile my
> > *.pl program
> >
> > to *.ext in NT. IS there any perl compiler been maken or source code I
> > can make
> >
> > them to compiler?  Would any body tell me?
> 
> "perldoc perlfaq3" for the question
> 
>         How can I compile my Perl program into byte code or C?
> 
> Also there might be something special for NT not unlike dump/undump for
> Unix.  Dunno, but it wouldn't be portable.
> 
AFAIK, no general dump/undump exists in WinNT. But there is a "compiler"
for Win32 Perl at : http://www.demobuilder.com/perl2exe.htm

I used it with ActiveState build 310. It worked well, but
the .exe you got was rather big. 


> Also, I note that ask for something with a .pl suffix.  .pl is, for the
> most part, ancient history.  .pl was for perl library files which have
> been replaced by perl module (.pm) files.  Are you using perl4 perhaps?
> Use "perl -v" to find out what version you use.
> 
> - doug

The suffixz is used in Windows for mapping files to their interpreters.
Unix shell looks at the she-bang (#!) line. Windows just tak the suffix.

I never used Perl4, but still all my scripts (except those I run by
PerlIS.dll)
have suffix .pl. It's not required by Perl, but by Windows.

At least, this is the suffix that gets mapped to perl.exe when you
install perl.

Jenda


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

Date: 22 Oct 1997 21:48:25 GMT
From: Zenin <zenin@best.com>
Subject: Re: Can perl be maken to Compiler instead of interpreter?
Message-Id: <62lsb9$fle$1@nntp2.ba.best.com>

Doug Seay <seay@absyss.fr> wrote:
	>snip<
> Also, I note that ask for something with a .pl suffix.  .pl is, for the
> most part, ancient history.  .pl was for perl library files which have
> been replaced by perl module (.pm) files.

	Actually, at nearly *every* sight I've worked at so far, .pl is used
	as the standard perl _program_ extension.  I would gather it's that
	way almost everywere, and with good reason.  It's the only extention
	that makes sense. -I'm not about to name my stuff, foo.perl and
	without any extention most people have to reset there editor config
	every time they open the file.

-- 
-Zenin (zenin@best.com)
 The Bawdy Caste (San Jose, CA)       http://www.netmagic.net/~dmcgrath/bawdy/
 Barely Legal   (Berzerkly, CA)                    http://www.barelylegal.org/
 Zenin's Rocky Archive (Moving soon!)              http://www.best.com/~zenin/


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

Date: 22 Oct 1997 16:07:26 -0500
From: will@Starbase.NeoSoft.COM (Will Morse)
Subject: Re: Children becoming ZOMBIE if parent still alive?
Message-Id: <62lpue$8mf$1@Starbase.NeoSoft.COM>


wait() or probably better, waitpid()

Will

In article <344cf15a.0@news.liberty.com>,  <dsalch@liberty.com> wrote:
>Keyword: 
>
>I am working on a program that launches children that run an indetermined amount of time
>and then exit normally, but the parent runs forever, launching
>children as needed to do certain tasks. The problem is that when the children
>die they go into zombies until the parent dies, which normally would
>be never. I have tried killing the processes form the parent, 
>forking children of children, etc. and nothing works without leaving
>some zombie running somewhere.
>
>What am I missing?
>
>Dave
>dsalch@liberty.com
>
>


-- 
# Copyright 1997 Will Morse.  Internet repost/archive freely permitted.
# Hardcopy newspaper, magazine, etc. quoting requires permission.
# 
#      Gravity,                    #    Will Morse
#      not just a good idea,       #    Houston, Texas
#              it's the law.       #    will@starbase.neosoft.com
#
#   These are my views and do not necessarly reflect anyone else/
 =========================================================================
      By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
      meets the definition of a telephone fax machine. By Sec.227(b)
      (1)(C), it is unlawful to send any unsolicited advertisement to
      such equipment, punishable by action to recover actual monetary
      loss, or $500, whichever is greater, for EACH violation.
 =========================================================================



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

Date: 22 Oct 1997 21:38:37 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: Data driven code...?
Message-Id: <toutatis-ya023180002210972338360001@news.euro.net>

pfortin@cisco.com wrote:

> I'm trying to write code to read lines from a file and invoke specific
> subroutines based on the input data (i.e., $data = "foo", so invoke:
> eval $data.'(@bar)'; which is really foo(@bar); ...)  So far, so good;
> but there are cases where the resulting call is to a non-existant
> routine (at least until I get arround to writing one).  I just need to
> know that this is not a valid routine name (and might never be).

Maybe this would do it for you?

my %subs = (foo => \&foo,
            bar => \&bar);

for (@input){
   exists $sub{$_} and &{$sub{$_}};
}
 
Then you don't need to eval, which can be a serious security risk unless
you use the Safe module.

> Since this project may never terminate, this will be a fact of life for
> my code.

Ouch...

--
Toutatis


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

Date: 22 Oct 1997 16:24:55 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: date in chat script
Message-Id: <62lnen$850@panix.com>

In <344E0B5B.1494@ptd.net> Randy <racioppi@ptd.net> writes:

>I am not really a perl programmer, and I am having problems getting my
>chat script to display the proper time when a message is posted.  The
>portion of the script that refers to the time is below.  I would very
>much appreciate any help you guys could provide.

>The time it shows when a message is posted is (12:am)


>Thank You,
>Randy


>#############################################################
># Section 3: get the time and format to look nice

>        $now_string = localtime;
>        @thetime = split(/ +/,$now_string);
>        @theclock = split(/:/,$thetime[3]);
>        $ampm = 'am';
>        if ($theclock[0] > 11)
>        { $ampm = 'pm'; }
>        if ($theclock[0] == 0)
>        { $theclock[0] = 12; }
>        if ($theclock[0] > 12)
>        { $theclock[0] -= 12; }
>        else
>        { $theclock[0] += 0; }

>#############################################################

Why not do something like:
  
  #!/usr/local/bin/perl5.000
  
  use POSIX qw(strftime);
  
  @time = localtime;
  
  print strftime("%r", @time);

It prints:

  04:22:02 PM

-- 
Clay Irving <clay@panix.com>                   http://www.panix.com/~clay/


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

Date: 22 Oct 1997 20:40:43 GMT
From: "win95" <vazquez2@ixc.net>
Subject: Digital UNIX 4.0 and Perl 5.004_01 Problems?
Message-Id: <01bcdf2a$6c9732c0$3d3046c6@tvazquez.colybrand.com>

Is anyone aware of any problems running 5.004_01 on Digital UNIX 4.0. 
Please feel free to email.

Vazquez2@ixc.net

thanks.


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

Date: Wed, 22 Oct 1997 21:37:56 -0700
From: Jan Krynicky <Jan@chipnet.cz>
To: ender@mythen.ch
Subject: Re: excel-files with perl?
Message-Id: <344ED4A4.76F6@chipnet.cz>

ender@mythen.ch wrote:
> 
> Hi All
> 
> I wrote a small CGI script which creates a HTML table from an SQL
> database. Now I would like also create a excel file "on the fly".
> Does anyone know how to create excel file with perl?
> 
> Thanks.
> 
> Josi

use Win32::OLE;

$excel = CreateObject Win32::OLE('Excel.Application');

$excel.NewWorkSheet();  #or something similar
 ...


I cannot give you more info since I never tried this with Excel.
Look at the VB programer's reference for Excel to see what
methods/properties are defined.


You probably could make up the file yourself, but this
job I REALY wouldn't wish to do.

Jenda


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

Date: 22 Oct 1997 21:09:21 GMT
From: ranson@infoave.net (Ranson)
Subject: Help with  formating text with perl
Message-Id: <62lq21$1p1@news1.infoave.net>


Greetings,

What I need to do is format text like a newspaper.

Take a block of text and format it so each line will 
have 40 charactors including spaces. If a word 
breaks in the middle then put a dash at the end 
of the word, ( if the word is >= 5 charactors ] else
pick 4 white spaces and add another space [ &nbsp; }

Basically so the test will line up on the left of the 
columb and the right. 

If this is possible, I need some help with the code.
I tryed several variations to do this but no........ did
work.



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

Date: Wed, 22 Oct 1997 14:42:01 -0500
From: "Adnan Hindi" <adnanh@allinfosys.com>
Subject: Help,perl will not load Advapi32.dll on NT
Message-Id: <62lkrs$gu8@news.cybernews.net>

I've tried looking around and just can't find any help on this problem.

I'm running IIS 3.0 and PerlIS build 110 on NT 4.0. The problem I am having
is that perl will stops working ever now and then and reports an error like:

Error executing CGI script: 'Could not load Advapi32.dll'?

Stoping the WWW service and restarting does not help. I have to reboot the
server.
I also checked the PerlErr.Log file and found a few:

INTERNAL ERROR: PerlParser did not exit clean!!

What does this meen?
Thanks for your help.
Adnan




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

Date: 22 Oct 1997 19:43:19 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: HELP: strange problems with if ()
Message-Id: <62ll0n$s96@news-central.tiac.net>

In article <62li27$ale@news.u-strasbg.fr>,
(null) <bboett@erm1.u-strasbg.fr> wrote:
>Hello,
>i am not really the professionnal perl programmer, so please don't
>blame me if it is a stupid question....
>
>here it goes, i have the following script:
>#!/usr/bin/perl
>$MKYBOOL = false;
>while (<>)
>{
> if (/^text.*$/) {
>    $MKYBOOL = true;
>  }
>
>  if ( $MKYBOOL == true ) {
>    print $MKYBOOL;
>    print "\n";
>  }
>
>  if (/"]\)/) {
>   $MKYBOOL = false;
>  }
>}

You might find using the -w flag useful as you're using == (the numeric
equivalence test) to compare strings, the strings 'true' and 'false' are
both "worth" 0 in a numeric context.  Doing something like

  if ($MKYBOOL eq 'true') {
    ...
  }

woutd test $MKYBOOL to see if it containes the string 'true'  Another way
to do this is to assign $MYKBOOL a value perl considers false (the number
0, or the empty string or the string '0' for example) or a value perl
considers true (perhaps the number 1) and just say

  if ($MKYBOOL) {
    ...
  }

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: 22 Oct 1997 20:47:09 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to go a particular line in a file?
Message-Id: <62lood$k0q$1@marina.cinenet.net>

John Robson (as646@FreeNet.Carleton.CA) wrote:
: 
: The special variable $. automatically keeps track of the line read and
: increments itself.
: But it doesn't allow you to modify it, to assign a value to it (?!).
: 
: Suppose I open a file and want to jump directly to, for example, line 8, how
: do I do this ?  Doing $. =+ 7 doesn't seem to work.

  while (<FILE>) {
    last if $. == 8;
  }

  if ($. == 8) {
    # Do the line-8 thing.
  }
  else {
    die "Hey, the input file had only $. lines!";
  }

Hope this helps...

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Wed, 22 Oct 1997 17:10:59 -0400
From: Mary Overby <mao@djembe.oit.unc.edu>
Subject: Internet Prgrammer Needed
Message-Id: <344E6BE3.4736@djembe.oit.unc.edu>

The Instructional Technologies Development Group is recruiting
for an Applications Analyst Programmer II to provide consulting 
and development services, principally to the ATN Simple Start Program.
This position will work closely with Simple Start and Development 
Group personnel to plan and implement complex software systems in
support of the Simple Start mission.
(http://sunsite.unc.edu/mao/itd/aap2.html)
 
    Title: APPLICATIONS ANALYST PROGRAMMER II
    Location: University of North Carolina - Chapel Hill
    Department: ATN - Development & Evaluation Division
    Job Family: Executive, Administrative, Managerial and Professional
    Position Number: 05052
    Salary Grade: 77
    Salary Range: $43,942 - $65,039
    Dept. Contact: Diane Strong
    Hiring Supervisor: Mary Overby
    Email: mary_overby@unc.edu
    Location: Davis Library
    Schedule: 8:00 am - 5:00 pm
 
Minimum Education and Experience: Bachelor's degree with nine semester
hours in data processing and three years of progressive experience in
programming and applications analysis; or a Bachelor's degree in
computer science, information systems management or a related curriculum
and two years of progressive experience in programming and applications
analysis; or an equivalent combination of education and experience.
A degree directly related to the technical nature of the application(s)
assigned may be substituted for up to six months of the experience
requirements.
 
Preferred Qualifications:
This position requires an in-depth understanding of both pedagogy and
contemporary collaborative Internet communications technology.  This
employee will work with end-users and ATN support personnel to develop
models for instructional delivery over the Internet and with a team of
applications and systems programmers to develop specifications 
for complex software systems to implement these instructional models. 
Experience with instructional methods, project planning and 
management, object-oriented analysis and programming techniques, and
collaborative Internet protocols
such as smtp, nntp, http, imap as well as evolving multimedia protocols
such as rtsp is highly desired. Teaching experience preferred. This
employee must be able to effectively communicate with others, both
verbally and in writing, and to establish and maintain effective and
amiable working relationships in a team environment.
 
If you are interested in this position, please apply to:
 
      Employment Department,
      Office of Human Resources,
      UNC Chapel Hill, Campus Box 1045,
      725 Airport Road, Chapel Hill, NC 27599-1045.
 
      http://www.adp.unc.edu/hr/
 
The University of North Carolina is an equal-opportunity employer.
 
The mission of the ATN Development and Evaluation Group is to formalize
the evaluation of strategic products and technologies, to provide 
a focus for software integration and development efforts across all 
ATN operating units, and to maintain leadership in researching and
implementing networked information technologies in support of UNC's
teaching and research missions.

-- 
        Mary A. Overby, Manager | Instructional Technologies 
Applications Analyst Programmer | Development & Evaluation Division
    http://sunsite.unc.edu/mao/ | Academic Technology & Networking
            mary_overby@unc.edu | Information Technology Services
                 (919) 962-6344 | UNC - Chapel Hill


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

Date: 22 Oct 1997 21:13:54 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: Move specified number of variables into one array???
Message-Id: <toutatis-ya023180002210972313550001@news.euro.net>

Michael.Bach@kst.siemens.de wrote:

> Hi there...
> 
> I have the following problem:
> 
> 1) I get a certain number of arguments from a HTML-form via CGI.pm
> 2) I know the number of arguments
> 3) I do a loop to work on each of the arguments using the number of
> arguments
> 
> ... this is where my problem comes in... I guess it's probably sheer
> stupidity:
> 
> I would like to do something like this:
> 
> while ( $bla != $numberOfArguments) {
>         do something with @argument[$bla] ;
>         $bla++;
>         }

I'm trying to read your intention.
I THINK you want to do something like this:

my $cgi = new CGI;
my @names = $cgi->param;
for (@names){
   print $_,"\n"; #prints the name of the parameter
   print $cgi->param($_),"\n"; #prints the value of it
}

-- 
Toutatis


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

Date: Wed, 22 Oct 1997 19:15:32 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: naming variables after other variables
Message-Id: <344e4eb0.453745371@igate.hst.moc.com>

[cc'd automagically to original author]

On 22 Oct 1997 16:40:13 GMT, mhempel@select.net () wrote:

>Can you declare a variable with the name of another variable?

Huh? You want to redeclare a variable?

>What would the syntax be?

Well, you don't "declare" variables as much as you just use them:

$a = 10;
$a = 20;

But you're probably asking about something different, and I'm not sure
where to start guessing.

Do you want to use the name of a 'global' variable in a subroutine? If
that's the case, look at my() or local().

Otherwise, try to give us a better idea of what you're needing to do
or hope that someone else can guess. :-)

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Wed, 22 Oct 1997 19:26:59 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: naming variables after other variables
Message-Id: <345d4a14.2498867@news.wwa.com>

On 22 Oct 1997 16:40:13 GMT, mhempel@select.net () wrote:

>Can you declare a variable with the name of another variable?
>
>What would the syntax be?

my ($a) = 'b';
LENIENT: {
no strict 'refs';
$$a = 'c';
}

$b now equals 'c'.  I bet there is a better way to do this, but what
do you expect for free?  :-)

Streben nach Wahrheit

Faust Gertz
Philosopher at Large


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

Date: Wed, 22 Oct 1997 19:42:08 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Newbie Question : remove files named $files
Message-Id: <34605609.5559508@news.wwa.com>

On 22 Oct 1997 19:49:24 +0200, haroldkl@stack.nl (Harold Kloosterhof)
wrote:

>I want to remove all files in directory /www/dir1/
>which which have '.blah.' in the name (this 'blah' I don't know,
>that's what the perl script finds out)
>Now I've got this string $files="/www/dir1/*.blah.*"
>
>I tried 
>   unlink ($files)
>and
>   unlink (<$files>)
>but that didn't do the trick. The camel does not help
>me any further ...

Yes, the camel and the manpages do help and if you read this
newsgroup, you would have seen me answer a similar question yesterday.
I have no idea why you think this would work.  Think about the
differences between a scalar and list context.  When you do, I think
you will see that what you meant to write was:

unlink <./www/dir1/*.blah.*>;

If you still don't get it, look in the perlfunc manpage.

:NAME 
:
:unlink - remove one link to a file 
:
:
:
:SYNOPSIS 
:
:unlink LIST 
:
:unlink 
:
:
:
:DESCRIPTION 
:
:Deletes a list of files. Returns the number of files successfully deleted. 
:
:    $cnt = unlink 'a', 'b', 'c';
:    unlink @goners;
:    unlink <*.bak>;
:
:Note: unlink will not delete directories unless you are superuser and the -U flag is supplied to Perl. Even if these conditions are
:met, be warned that unlinking a directory can inflict damage on your filesystem. Use rmdir instead. 
:
:If LIST is omitted, uses $_. 

If you still don't get it, try looking at the perldata manpage
(Especially the 'Context' subsection).  If that doesn't do the trick,
ask again.


Streben nach Wahrheit

Faust Gertz
Philosopher at Large


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

Date: Wed, 22 Oct 1997 15:13:45 -0400
From: "James D. Patton Jr." <patton@micro.ti.com>
Subject: Re: Opening a network connected drive from dos w/ perl
Message-Id: <344E5068.9FEEF04@micro.ti.com>

The return address is incorrect. It should be patton@micro.ti.com.....maybe
thats why no one has answered my question???

        Thanks,
   Jim Patton

James Patton wrote:

> I currently running Win 95' and using the PC version of Perl. I was
> wondering if there is some way to have my perl script open up a network
> drive? I just wrote a very simple find script, I run it from c: and want
> it to connect to a network drive and exe. the script, and then post the
> results on c:......Is this possible?????
>
> [heres the script if it helps]
> [begin script]
> #!/usr/local/bin/perl
>
> eval 'exec perl -S $0 ${1+"$@"}'
>         if $running_under_some_shell;
>
> require "find.pl";
>
> open(LOG, ">c:\temp\find.log");   #putting the info on c:\temp
> # Traverse desired filesystems
>
> &find('e:.');     #e:. is the network drive trying to connect to.
>
> exit;
>
> sub wanted {
>     /^'*\.X.*'$/ &&
>     print("$name\n");
> }
> [end script]
>
>         Thanks for any help.
>            JIM



--
<x-rich><color><param>0000,0000,8080</param>+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

</color><bigger><bigger>J</bigger></bigger>ames D. Patton
MSGID:JDPJ

<bigger><bigger>T</bigger></bigger>exas
<bigger><bigger>I</bigger></bigger>nstruments
<bigger><bigger>P</bigger></bigger>ittsburgh
patton@micro.ti.com

Computer Operations           <bigger><bigger>S</bigger></bigger>ystems
<bigger><bigger>A</bigger></bigger>dministrator

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

</x-rich>




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

Date: Wed, 22 Oct 1997 21:46:46 GMT
From: pasn@ix.netcom.com
Subject: Passing Associative Arrays to a subroutine
Message-Id: <344e7363.10650094@nntp.netcruiser>


   I am trying to pass 2 associative arrays as arguments to a
subroutine.  I get the values of the first array only   and the code
looks  like

********

     ...
     ....
     &comp_str(%enustr,%frastr);
     ...
     ...
     ..

#======Begin Subroutine  ====================
sub comp_str{
    local(%enustr,%langStr);
    (%enustr,%langStr)=@_;

    foreach $key (keys(%enustr))
    {
         if ($enustr{$key} ne $langStr{$key}){
            print  "\n";
            print $key ;
            print  "\t";
            print  $enustr{$key};
            print "\t";
            print  $langStr{$key};
            print "\n";
            }
   }
}

********


what do I need to do differently?

Thanks

raj



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

Date: Wed, 22 Oct 1997 14:36:29 -0600
From: rex@atomicvision.com
Subject: Re: perl + Blat on NT problem
Message-Id: <877548367.30597@dejanews.com>

In article <877535077.14150@dejanews.com>,
  matthewb@atomicvision.com wrote:
>
> I am using Blat 1.5, NT 4, and Activeware Perl build 504.
>
> + Blat works from the command line.
> + a Perl script that calls Blat works from the command line.
> + the same perl script, executed through a web browser, does NOT
> successfully call Blat.

I answered my own question. Here it is for the benefit of the audience
(I'm using IIS 3 by the way):

My .pl files were set to be interpreted by PerlIS.dll, not Perl.exe. I
added a registry entry for .plx that routed to Perl.exe. When I put the.
 ..plx extension on the perl script (that calls Blat), and used Perl.exe
instead, it worked fine.

So, I suppose the lesson here is that when you want to use Blat, Perl,
and IIS together, use the Perl.exe interpreter.


Matthew Butterick
Atomic Vision

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 22 Oct 1997 16:25:19 -0600
From: wilson.sinclair@dial.pipex.com
Subject: Perl for NT and ARGV parameters
Message-Id: <877544023.24897@dejanews.com>

I have installed 5.0003_07 of Perl for Win32 on my NT4.0 machine. My Perl
scripts use command line arguments that can be extracted from ARGV[0-x].
My problem is that using the normal perl.exe "%s" "%s" association (what
does the %s mean ?) I cannot seem to read the ARGV elements correctly. My
current workaround is to use perl.exe "%1" "%2".... which seems to work.

Any idea how I can get this to work correctly ?

Wilson

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 22 Oct 1997 19:28:07 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Perl5.003 source ???
Message-Id: <62lk47$r4o@news-central.tiac.net>

In article <62lcu6$m2j$1@news.interlog.com>,
David Mayerlen  <tbag@interlog.com> wrote:
>Jeremy D. Zawodny <zawodny@hou.moc.com> wrote:

>: Why not use 5.004 anyway? Is there something wrong with it?

> There is probably nothing wrong with perl5.004, but a major web-ecommerce
>application was put through weeks of testing on perl5.003 and from
>Management's point of view, changing to perl5.004 will require re-testing
>of the application. At this point, we just want to recompile perl5.003
>with a better compiler and ensure optimal compile time options to squeeze
>as much performance as we can out of it. The application is running a
>little slower than was promised to the customer!

A quick search at http://www.hotbot.com threw up
http://www.system.gsl.net/symlinks/sources/compilefiles/
amongst other places as having perl5.003.tar.gz

If you have a slow web application you might want to look at
http://perl.apache.org for one way of speeding things up in the future.

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: 22 Oct 1997 12:00:30 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Precompiling PERL Scripts.....
Message-Id: <62lige$978$1@shell3.ba.best.com>

In article <01bcdf0d$c0cc13a0$972e63cf@spawn.imedianet.com>,
Richard Secor <rich@imedianet.com> wrote:
>I know there's a way to do this so I'm asking,
>
>how do you compile PERL scripts into executables so they run faster

There is a way to compile perl scripts into executables using Malcolm 
Beattie's perl compiler modules. However, compiling your scripts does
not necessarily make them run faster. As the Perl FAQ says:

  Please understand that merely compiling into C does not in and of itself 
  guarantee that your code will run very much faster. That's because except 
  for lucky cases where a lot of native type inferencing is possible, the 
  normal Perl run time system is still present and thus will still take just 
  as long to run and be just as big. Most programs save little more than 
  compilation time, leaving execution no more than 10-30% faster. A few rare 
  programs actually benefit significantly (like several times faster), but 
  this takes some tweaking of your code. 

You'll find the following sections of the perl FAQ to be helpful (available
from http://www.perl.com/perl/faq):

     How can I compile my Perl program into byte-code or C? 
     How can I make my Perl program run faster? 
     How can I make my CGI script more efficient? 

Hope this helps.

Matthew

-- 
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: Wed, 22 Oct 1997 18:55:37 GMT
From: joel@wmi0.wmi.com (Joel Coltoff)
Subject: Re: Random number in perl.
Message-Id: <62li7f$61t@netaxs.com>

In article <344E49E4.3EC@tkj.se>, Eric Persson  <persson@tkj.se> wrote:
>I need to make a random nr in perl. Someone got a simple syntax for
>this??

First off comp.lang.perl is a dead newsgroup. Don't use it anymore.

Sure. It would be the someone who wrote the perl docs that come
with your system. You might want to start by using

	$random = rand;

Although I think this can be improved somewhat. When I need one
I send the following postscript to my printer and then type the
number into my program.

	/Helvetica findfont 12 scalefont setfont
	1000 1000 moveto rand str cvs show
	showpage

One of these days I'll print a couple sheets to keep by my desk.

>Please help me and reply via e-mail!

Please help yourself and read the docs and the newsgroup.

-- 
Joel Coltoff

I'd explain it, but there's a lot of math. -- Calvin


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

Date: Wed, 22 Oct 1997 19:34:27 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Random number in perl.
Message-Id: <345f53dc.5003118@news.wwa.com>

On Wed, 22 Oct 1997 19:45:56 +0100, Eric Persson <persson@tkj.se>
wrote:

>I need to make a random nr in perl. Someone got a simple syntax for
>this??

Read the FAQ.

:Why aren't my random numbers random? 
:
:The short explanation is that you're getting pseudorandom numbers, not random ones, because that's how these things work. A
:longer explanation is available on http://www.perl.com/CPAN/doc/FMTEYEWTK/random, courtesy of Tom Phoenix. 
:
:You should also check out the Math::TrulyRandom module from CPAN. 

and here is Tom's explanation:

:Date:         Sat, 8 Mar 1997 17:09:47 -0800
:From:         Tom Phoenix <rootbeer@teleport.com>
:Subject:      Re: mathematically correct?
:To:           "Thomas A. Loser" <tloser@valdemar.microserve.com>
:In-reply-to:  <tloser-0503971240210001@168.133.124.5>
:Organization: Society for the Elimination of Excess Superfluous Text in Internet Header Lines
:Newsgroups:   comp.lang.perl.misc
:Article: 69765 of comp.lang.perl.misc
:
:Replied:      Sun, 09 Mar 1997 10:24:12 -0700
:              Tom Phoenix <rootbeer@teleport.com>
:
:On Wed, 5 Mar 1997, Thomas A. Loser wrote:
:
:>   The PERL (camel) book gives an example for selecting a random line
:> from a file of unknown length with a single pass through the file:
:
:>   srand;
:>   rand($.) < 1 && ($it = $_) while <>;
:
:As other posters have pointed out, this is mathematically correct in
:general. It can fail, though, for very large files because of the way in
:which rand() is implemented.
:
:rand calls your system's random number generator (or whichever one was
:compiled into your copy of Perl). For this discussion, I'll call that
:generator RAND to distinguish it from rand, Perl's function. RAND produces
:an integer from 0 to 2**randbits - 1, inclusive, where randbits is a small
:integer. To see what it is in your perl, use the command 'perl
:-V:randbits'. Common values are 15, 16, or 31.
:
:When you call rand with an argument arg, perl takes that value as an
:integer and calculates this value. 
:
:                         arg * RAND
:           rand(arg) = ---------------
:                         2**randbits
:
:This value will always fall in the range required.
:
:           0  <=  rand(arg)  < arg
:
:But as arg becomes large in comparison to 2**randbits, things become
:problematic. Let's imagine a machine where randbits = 15, so RAND ranges
:from 0..32767. That is, whenever we call RAND, we get one of 32768
:possible values. Therefore, when we call rand(arg), we get one of 32768
:possible values. 
:
:If we want to pick a random digit, though, there's a small problem: 32768
:isn't evenly divisible by 10, so some digits need to have higher
:probability than others. That is, when we calculate int(rand(10)), there
:are 3276 possible values of RAND which lead us to choose some digits, and
:3277 possible values which lead to others. Since both 3276/32768 and
:3277/32768 are very close to 1/10, this isn't usually a problem. 
:
:But if arg = 1000, now there are either 32 or 33 possible values of RAND
:for each possible value of int(rand(1000)). And 32/32768 and 33/32768
:aren't especially close to 1/1000. Still, this might be suitable for some
:purposes.
:
:But suppose arg = 100_000? Now, there are 100_000 integer values which we
:would like for int(rand(100_000)) to assume, but it can only reach 32768
:different values! That value will be 0 about 1 time in 32768, but it'll
:_never_ be 1. Or 2, even. Dang.
:
:There are other aspects to this problem, too. On a machine with
:randbits=15, rand(65536) will always be an even integer. You don't even
:have to use int on it! And there are lots of machines with such small
:randbits. 
:
:If you have access to a fairly fast machine on which randbits is small
:enough, try this test script to see how much "luck" it takes to hit one
:chance in one billion. On a machine with randbits=15, you'll probably be
:that lucky about 30 or 31 times, and if randbits=16, it'll be about half
:that. Of course, if your randbits=31, you'll have to _really_ be lucky to
:even get one!
:
:     perl -e 'srand; $c = 0; for ($i=0; $i<1e6; $i++)' \
:        -e '{ $c++ if rand(1e9) < 1 } print "$c\n"'
:
:This means that on a machine with small randbits, you shouldn't expect
:two-line script to choose each line of a large file with equal
:probability. Later lines may be chosen with higher frequency than they
:deserve. 
:
:Hope this helps! 
:
:-- Tom Phoenix        http://www.teleport.com/~rootbeer/
:rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
:Randal Schwartz Case:     http://www.lightlink.com/fors/
:
:
:
:EDITOR NOTE: See all the Math::TrulyRandom module from CPAN. --tchrist

>Please help me and reply via e-mail!

If you post to a newsgroup, you should read the newsgroup.


Streben nach Wahrheit

Faust Gertz
Philosopher at Large


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

Date: Wed, 22 Oct 1997 16:01:56 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: sorting code?
Message-Id: <344E69C4.1764@hackberry.chem.niu.edu>

Ernie Johnson wrote:
> 
> in lieu of re-inventing the wheel, does anyone have any code to sort a small
> (200 item) list or know of where there is a routine to do this?
> 
> please cc replies to tcm@tcmd.com if convenient.
> 
> Ernie Johnson
> TCM Online

# -- create  list sorted in original order
@sorted_list = @list;


Oh, maybe your want to sort according to some criteria?

@sorted_list = sort {by_unknown_criteria} @list;

I think that should do it. All YOU have to do is supply:
* a subroutine 'by_unknown_criteria'
* the original list

You might want to check out some FAQs, etc.
see e.g.

ftp://ftp.nuri.net/pub/CPAN/doc/FMTEYEWTK/sort.html
-- 
==========================================================
 - darin
burleigh@hackberry.chem.niu.edu
\\//\\//.\\//\\//.\\//\\//. http://hackberry.chem.niu.edu/HOME/dcb/
 '2 kinds of green, look out!' - dieter rot


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

Date: Wed, 22 Oct 1997 13:41:41 -0700
From: David Mills <david@ipac.caltech.edu>
Subject: Timing out sys process?
Message-Id: <344E6505.9FDEE133@ipac.caltech.edu>

Hey, all...

I am writing a script to use the UNIX "rsh" command to query all the
IP-based hosts in our building. Since the list I receive from "ypcat
hosts" includes Macs, PC's, printers, router boxes, etc. that have IP
addresses but aren't UNIX boxes, I don't want my script to hang trying
to send a UNIX command to, say, a printer.

Question: how can I get my program to time out a UNIX command generated
via PERL's `` or system() call? So far, I've tried creating a string
variable like this:

    $time_bomb = "sleep 5; kill -9 `ps -ef | egrep \"rsh $ip_addr\" |
egrep -v egrep | awk '{print $2}'`";

and then planting it in the middle of my command like this:

    `$time_bomb&; rsh $ip_addr $remote_command`;

in the hopes of giving the "rsh" command about five seconds to get its
act together and exit before my "$time_bomb" command wakes up, isolates
the pertinent process ID and kills it.

I have not mastered the shell-syntax intricacies to carry out my
shell-ish plot, nor am I convinced that this is the best, most
straight-forward way of doing what I want.

'Suggestions?

Thanks so much,

david

David G. Mills
Systems Administrator
IPAC, Caltech
david@_REMOVE_THIS_ipac.caltech.edu



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

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

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