[6286] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 908 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 6 21:07:19 1997

Date: Thu, 6 Feb 97 18:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 6 Feb 1997     Volume: 7 Number: 908

Today's topics:
     Re: "-i" switch is unsafe! <tchrist@mox.perl.com>
     'do' and command-line parameters <morpheus+@andrew.cmu.edu>
     Accessing DB2 Database Thru Sybase Gateway w/out Using  <mikeo@gsd.state.nm.us>
     ANNOUNCEMENT: Perl documentation and FAQ discontinued <tchrist@mox.perl.com>
     Re: Anyone got a base64 encoder? <sharris@bev.etn.com>
     Re: Calculating easter (Lars-Gunnar Taube)
     Re: DNS lookups in perl <rra@cs.stanford.edu>
     fcntl() in v4 (Bob Dixon)
     File handle referring to a string... (Dan Walters)
     Re: FTP Client (Craig S. Riter)
     Re: FTP Client <tchrist@mox.perl.com>
     getDate??? <slambert@avenor.com>
     Re: getDate??? (Dave Thomas)
     Re: How do I undefine a format? (and request for a Form (Charles DeRykus)
     How do U copy a directory? <atticus@wealthcomreps.com>
     Re: How to do this using perl? <tchrist@mox.perl.com>
     Interesting behaviour of ?: with delete <chris@ixlabs.com>
     IS Perl on NT Thread Safe ? <nickl@telebusiness.co.nz>
     PERL / ODBC <brian@shepmark.com>
     Perl 5 package problems <malcolm@synopsys.com>
     Re: Perl rand() function on solaris SPARC (Kevin Gardner)
     Re: Perl regexes are *not* greedy (was Pattern Matching (Chris Nandor)
     Re: perl tcl extension (Matthew H. Gerlach)
     Re: printf and % <tchrist@mox.perl.com>
     Re: Script to Find-replace (Nathan V. Patwardhan)
     Sending results to two frames at once (Roger Lewau)
     Re: setuid() <rootbeer@teleport.com>
     Re: Shell "case" command in perl (Kirby Hughes)
     sybperl for the MacIntosh ? <rsmith@proteus.arc.nasa.gov>
     Re: Using exec-Why won't this work? <tchrist@mox.perl.com>
     Wanted NT Perl Script (Brian Mc Daniel)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 7 Feb 1997 00:13:06 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: "-i" switch is unsafe!
Message-Id: <5dds2i$92u$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, joe_bednorz@inteq.bhi-net.com writes:
:Joe Bednorz     	Proud Member of the Unix-Hater's Mailing List

Get stuffed.

--tom, proud owner of member of a specially made Joe Bednorz Killfile.
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com
    "I will always write it the second way, so if you're optimizing for
    contrariness, it's obviously better to do it the second way."
    	--Larry Wall


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

Date: Thu,  6 Feb 1997 18:23:36 -0500
From: Gautam Srikanth <morpheus+@andrew.cmu.edu>
Subject: 'do' and command-line parameters
Message-Id: <8myaTsa00YUs0n3W00@andrew.cmu.edu>

Hello all.

    I'm trying to execute a perl script from within another, referencing
it by filename.  Normally, saying:

    do 'foo.pl';

would work.  However, if I try to pass the script command-line
parameters, like:

    do 'foo.pl bar';

nothing happens.  Is there any way to pass parameters to another perl
script without having to resort to system()?

thanks,

    -- Gautam

Gautam Srikanth            \ "rising falling at force ten
morpheus+@andrew.cmu.edu    \  we twist the world and ride the wind..."
www.andrew.cmu.edu/~morpheus \  (Rush, "Force Ten")



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

Date: Thu, 06 Feb 1997 16:44:05 -0700
From: Michael Owens <mikeo@gsd.state.nm.us>
Subject: Accessing DB2 Database Thru Sybase Gateway w/out Using Sybperl
Message-Id: <32FA6CC4.1E43@gsd.state.nm.us>

I have to write a web application that accesses data 
from a DB2 mainframe database thru a Unix-based Sysbase 
gateway.  

I'd like to write it in perl, but I'm under pressure 
from the powers that be to write it in C using an 
existing web app as a guide.

To make my case for writing this app in perl, I need
to demonstrate that I can turn out the app quicker
using Perl rather than C.

So: is it possible to interact with Sybase (on the
Unix platform) using just plain old Perl 5.003, and 
if so, how?

Alternately, if I have to use Sybperl, could anyone
give me pointers as to how to do it that way?

Time is of the essence for me, so any quick replies
would be greatly appreciated.

Thanks.

Mike Owens
mowens@state.nm.us


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

Date: 7 Feb 1997 00:33:42 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: ANNOUNCEMENT: Perl documentation and FAQ discontinued
Message-Id: <5ddt96$9gh$1@csnews.cs.colorado.edu>

As of the next release of Perl, no documentation or examples will
be shipped, since no one reads them anyway.  Furthermore, the FAQ
is also discontinued.  Please remove copies of any of this documentation
wherever you may find it, since it's obvious from the postings in this 
group that it has never done a bit of good.

mot--
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com
echo $package has manual pages available in source form.
echo "However, you don't have nroff, so they're probably useless to you."
    --Larry Wall in Configure from the perl distribution


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

Date: Thu, 06 Feb 1997 16:51:16 -0500
From: Steve Harris <sharris@bev.etn.com>
Subject: Re: Anyone got a base64 encoder?
Message-Id: <32FA5254.41C67EA6@bev.etn.com>

Check the example on page 237 of Camel 2.

-- 
 Steve Harris - Eaton Corp. - Beverly, MA - sharris@bev.etn.com


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

Date: 6 Feb 1997 23:36:12 +0100
From: lgt@init.se (Lars-Gunnar Taube)
Subject: Re: Calculating easter
Message-Id: <5ddmcs$jhs@ming.init.se>

Jonas Liljegren <jonas@cultcom.se> writes:

>How do I calculate the date of easter?

By using Gauss' Easter Formula, which, given a year, will calculate
the day of easter for that year.

I have on paper _somewhere_, but it'll probably be faster for you
to look it up in a mathematical thesaurus, or some such beast.

use Brain;

Hmm. I _think_ the formula is mentioned in Bra Bvckers Uppslagsbok,
I got my paper copy from the man who wrote the entry in the encyclopedia.

Good Luck,


     --lgt

1;

-- 
Lars-Gunnar Taube  init ab  lgt@init.se  http://www.init.se  +46 70 5424792


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

Date: 06 Feb 1997 15:12:23 -0800
From: Russ Allbery <rra@cs.stanford.edu>
Subject: Re: DNS lookups in perl
Message-Id: <qumd8udcyw8.fsf@cyclone.stanford.edu>

Michael Fuhr <mfuhr@dimensional.com> writes:

> Net::DNS 0.01 was written mostly in C and used the system's resolver
> (libresolv) and another library called resparse.

> Net::DNS 0.02 is written entirely in Perl, so it reimplements the
> resolver library using many of the same algorithms.  I know that sounds
> like reinventing the wheel, but I chose to do it for the following
> reasons:

>     1.  To let Perl handle more of the memory management.
>     2.  To provide more consistent behavior across different platforms.
>     3.  To see if I could.

> The Perl version runs much slower than the C version, but if you're
> doing remote lookups then a busy network will probably be your
> bottleneck.  Personally I'm partial to the Perl version but future
> versions may be a combination of both.  User input will certainly
> provide guidance.

I personally would prefer to see the module written mostly in C, or at
least as a Perl wrapper around a sufficient amount of C to link against
libresolv, so that when compiling the module I could link it against the
libresolv in BIND rather than against the system version.

There are a few reasons why I prefer that:

   1. One is pretty much guaranteed that if one uses BIND, one will be
      able to access the latest and greatest in DNS in the most efficient
      and compatible way possible.

   2. Things like NIS, local hosts files, and so forth are all potentially
      handled automagically for you (if you link against the system
      version).

   3. When the next version of BIND comes out, you don't have to
      reimplement all of the changes yourself.

It seems like reimplementing things in Perl is going to result in forking
and version skew between your version and BIND.  Of course, you have a
very good point about other platforms where libresolv isn't available.

-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>


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

Date: Thu, 6 Feb 1997 23:00:37 GMT
From: sasrmd@unx.sas.com (Bob Dixon)
Subject: fcntl() in v4
Message-Id: <sasrmd.855270037@sas.com>

  I'm somehow not getting all the pieces right.  In C, I do this:


        struct flock lock;

        lock.l_type = F_WRLCK;
        lock.l_start = 0;
        lock.l_whence = SEEK_SET;
        lock.l_len = 0;

        fcntl(fd, F_SETLKW, &lock);

  and it works.

  In perl, I'm doing this:

fcntl(OUTFILE, &F_SETLKW, 0) || die "fcntl failed";

and 

fcntl(OUTFILE, &F_SETLKW, &F_WRLCK) || die "fcntl failed";

and getting "fcntl failed" both ways.

Any suggestions?  I even tried reading the book, i.e. p. 144 of the
Camel book, and I'm still not getting the idea.

Thanks!

--
--

Bob Dixon (sasrmd@unx.sas.com)
Tool Development and Training
SAS Institute, Inc.
919-677-8000, x6685, R-2138  


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

Date: 7 Feb 1997 00:26:28 GMT
From: djw@ccwf.cc.utexas.edu (Dan Walters)
Subject: File handle referring to a string...
Message-Id: <5ddsrk$qlt@geraldo.cc.utexas.edu>

I'm wondering if anyone knows of a way to make a filehandle that would
refer to a string?  I'd like to be able select() a filehandle that
refers to a string and have all my print statements actually just
append to that string.  I looked on CPAN and didn't see a module that
seems to do this, so thought I would ask.

What I'm wanting it for is a rather large FCGI script.  I use an
eval/die error handling mechanism, but when I do a die it will have
already printed some output, so I always wind up with a partial page
followed by Content-type:, etc., which of course looks really odd.
I'd like to actually just put all my output in a string and then print
it at the end if there are no errors.

Currently, I can only figure I either have to use temporary files (I'd
really rather not) or I have to actually append to a string instead of
using print, which just doesn't feel natural...  (So I'm picky!)

So, is this possible?  Just another thing I'd have no problem doing in
C, I suppose...  Thanks in advance for any suggestions!

--
---------------------------------------------------------------------------
Dan Walters
djw@mail.utexas.edu
---------------------------------------------------------------------------


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

Date: Thu, 06 Feb 1997 22:15:48 GMT
From: criter@lucent.com (Craig S. Riter)
Subject: Re: FTP Client
Message-Id: <32fd57a5.28363025@nntp.cb.lucent.com>

You might try using an editor that can store the file in Unix format
without the extra CarriageReturn (CR).  I like PFE.  Try searching for
it on www.shareware.com.  It is free and can be helpful.  

You can also transfer the file as ASCII which will also fix the
problem that you mentioned.

Craig
criter@riter.com

On Wed, 05 Feb 1997 21:03:21 -0800, A MAGIC STORE
<max@amagicstore.com> wrote:

>I've programmed a couple of scripts in Perl, I've uploaded them to my
>server (UNIX) but they are not working. My server said that there is a
>^M (new line) at the end of each line. I'm using Win95 Notepad.
>Does anybody know any FTP client or other program that transform MS-DOS
>based text files into UNIX text files (basically without the ^M at the
>end of each line)??
>
>Thank you.
>
>Max

______________________________________________________________________
Craig S. Riter         criter@riter.com         criter@povpartners.com
www.riter.com                           PGP key available upon request
It infuriates me to be wrong when I know I'm right.           -Moliere


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

Date: 7 Feb 1997 00:20:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: FTP Client
Message-Id: <5ddsfg$995$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    max@amagicstore.com writes:
:Does anybody know any FTP client or other program that transform MS-DOS
:based text files into UNIX text files (basically without the ^M at the
:end of each line)??

I've always found the Redhat CDs remarkably effective at this.a

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com

    "It is easier to port a shell than a shell script."
		--Larry Wall


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

Date: 6 Feb 1997 21:46:04 GMT
From: "Sebastien Lambert" <slambert@avenor.com>
Subject: getDate???
Message-Id: <01bc1477$62ea0960$370a010a@slamber.Avenor.com>

How can I change a string like '02/06/97' or any others strings dates
to the number of seconds since 00h00.00 January 1, 1970.

Thanks for help!!!



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

Date: 6 Feb 1997 23:03:49 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: getDate???
Message-Id: <slrn5fkomb.tqq.dave@fast.thomases.com>

On 6 Feb 1997 21:46:04 GMT, Sebastien Lambert <slambert@avenor.com> wrote:
> How can I change a string like '02/06/97' or any others strings dates
> to the number of seconds since 00h00.00 January 1, 1970.

Maybe something like:


#!/usr/bin/perl -w
use Time::Local;

die "usage:  $0 mm/dd/yy" unless ($ARGV[0] =~ m!^(\d{1,2})/(\d{1,2})/(\d{1,2})$!);


my ($mon, $day, $year) = ($1-1, $2, $3);

$year += 100 if ($year < 50);

my $secs = timelocal(0, 0, 0, $day, $mon, $year);

print "Now = ", time, ".  $ARGV[0] = $secs\n";




-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Fri, 7 Feb 1997 00:26:55 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: How do I undefine a format? (and request for a Format module)
Message-Id: <E57IKv.3C3@bcstec.ca.boeing.com>

In article <reh9152n8lq.fsf@qtp.ufl.edu>,
Sullivan Beck  <beck@qtp.ufl.edu> wrote:
 >
 >I have a subroutine in which I define a format on the fly (as per the
 >perlform man page).  The only problem is that when I call this subroutine
 >twice (using the -w flag), I get the annoying message that the format
 >has been redefined.
 >
 >A trivial illustration is:
 >
 >################################
 > #!/usr/local/bin/perl -w
 > 
 > sub Test {
 >   my($f)="format AAA =\nHi there\n.\n";
 >   eval $f;
 >   $~ = "AAA";
 >   write;
 > }
 > 
 > &Test();
 > &Test();
 > ################################
 > 
 > which produces the following output:
 > 
 > Hi there
 > Format AAA redefined at (eval 2) line 1.
 > Hi there
 > 
 > 
 > The format I want to use is not constant.  It will depend on data that gets
 > passed in.  Also, I don't want to define a new format (i.e. a format with a
 > different name) each time, because that almost amounts to a memory leak
 > (each call would leave a defined lying around that I'd never use again).
 > 
 > So, how do I undefine the format I just created?  The obvious
 >   undef "AAA"
 > didn't work (I didn't expect it to).
 > 
 > Sorry if I missed something obvious in the man page.
 > 
 > 
 > The two types of "variables" in perl that have always given problems
 > (especially when using strict, or in modules) have been filehandles and
 > formats.  Filehandles are nicely taken care of with the FileHandle (or
 > IO::Handle) module.  I don't suppose anyone's working on a similar module
 > for formats is there?  I'd love to easily be able to pass a format into or
 > out of a module and not have to worry about the complexity of the namespace
 > of the variables used in the format.  If no one's working on it, I may have
 > to sit down and do one sometime.


   Perhaps, you could just turn off the warning... until Format.pm comes 
   along.

   { local $^W = 0 ; eval $f; die $@ if $@ }




HTH,

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


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

Date: Thu, 06 Feb 1997 17:56:02 -0600
From: Atticus Killough <atticus@wealthcomreps.com>
Subject: How do U copy a directory?
Message-Id: <32FA6F91.7486@wealthcomreps.com>

Hi!

Curious to know how in my CGI/Perl script I am writing I can get my
program to recursively copy one directory into another that hasn't 
been created.

In my korn shell the command would be:

cp -R /usr/home/myname/the_directory /usr/home/myname/new_directory

I tried running this from the following line

system 'cp -R /usr/home/myname/the_directory
/usr/home/myname/new_directory';

Why doesn't this work?  Is there a better way to copy a subdirectory?
Please send reply to atticus@wealthcomreps.com

Thanks!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Atticus Killough: Independent Member Representative,
		    WealthCom Communications
            E-mail: atticus@wealthcomreps.com
     Where it's at: http://www.wealthcomreps.com/atticus
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 7 Feb 1997 00:08:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to do this using perl?
Message-Id: <5ddrp2$92f$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, dbenhur@emarket.com writes:
:Or what I would do since most of my scripts want to run
:on both DOS & unix:
:
:@data = split /\\|\//, $file_path_and_name;

Remind me to make files with backslashes in them.

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com
    "We all agree on the necessity of compromise.  We just can't agree on
     when it's necessary to compromise."
		--Larry Wall in  <1991Nov13.194420.28091@netlabs.com>


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

Date: Thu, 06 Feb 1997 15:22:13 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: Interesting behaviour of ?: with delete
Message-Id: <32FA67A5.7087@ixlabs.com>

I can do this, and it works:

!exists $acks{$1} ? $acks{$1}='' : delete $acks{$1};

But if I do the more straightforward:

exists $acks{$1} ? delete $acks{$1} : $acks{$1}='';

I get something like:
Can't modify delete with scalar assignment

In case you were wondering why I would write this line, it's
a great way to get the difference of two arrays in a 
foreach(@array1,@array2) loop into keys %acks assuming each 
element in an each individual array is unique.

-- 
Chris Schoenfeld
IX Development Laboratories   
Santa Rosa, California
(707)-543-8030 Ext. 12


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

Date: 6 Feb 1997 23:16:05 GMT
From: "nick" <nickl@telebusiness.co.nz>
Subject: IS Perl on NT Thread Safe ?
Message-Id: <01bc1484$2e2e34f0$c9e824ca@nick_nt>

This  is a very serious question.

Is Perl on NT thread safe ?

I can not find any docs that say yes or no. Dose anyone have experience and
can say yes or no?

Thanks

Nick


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

Date: 7 Feb 1997 01:26:57 GMT
From: "Brian Shepard" <brian@shepmark.com>
Subject: PERL / ODBC
Message-Id: <01bc149e$daa3fde0$a154b5cf@default>

I am having problems connecting to any dsn, the code I'm using is part of
the test program that comes with the Perl extensions for ODBC.

    print "\nOpening ODBC connection for \"$DSN\" ";
    if (!($O = new Win32::ODBC($DSN))){
        print "Error opening a connection.\n";
        exit();
    }
    Error();

This is the output I get:

------- T E S T  # 2  (Dump available datasources) ----
-------                                            ----

Here are the available datasources...
	DSN="Product" ("SQL Server")
	DSN="Sale" ("SQL Server")
	DSN="ebeem_restaurant" ("SQL Server")
	DSN="ebeem_children" ("SQL Server")
	DSN="Rental" ("SQL Server")
	DSN="CF Examples" ("Microsoft Access Driver (*.mdb)")
	DSN="ebeem_sports" ("SQL Server")
	DSN="ebeem_master" ("SQL Server")
	DSN="ebeem_outdoor" ("SQL Server")
	DSN="ebeem_cultural" ("SQL Server")
	DSN="Lodge" ("SQL Server")
	DSN="Web SQL" ("SQL Server")
	DSN="ebeem_box_office" ("SQL Server")
	DSN="Events" ("SQL Server")
	DSN="ebeem_fitness" ("SQL Server")
	DSN="ebeem_test" ("SQL Server")
	DSN="ebeem_admin_sales" ("SQL Server")
	DSN="ebeem_comedy" ("SQL Server")
	DSN="ebeem_music" ("SQL Server")

------- T E S T  # 3  (Open several connections) ----
-------                                          ----

Opening ODBC connection for "ebeem_music" Error opening a connection.



Any is help is greatly appreciated!!!

Thanks


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

Date: Thu, 06 Feb 1997 16:46:59 -0800
From: Tim Malcolm <malcolm@synopsys.com>
Subject: Perl 5 package problems
Message-Id: <32FA7B83.167EB0E7@synopsys.com>

I'm experiencing some difficulties with Perl 5 and packages (and I'm
still
lost after several hours with the camel book!) and would appreciate any
kind of feedback on this!

The problem in a nutshell: I've created packages whose attributes and 
methods can be accessed from within 'main' but not from within other
packages, even though the variable containing the package reference
is declared 'globally'.

It seems fairly obvious that the problems are all related to the package
not being initialised/created/referenced properly, but I just can't
figure out
how or why!



 

This is my 'generic' package constructor:
	package Interface;

	sub new {
    		my $holder = shift;
		my $type = ref($holder) || $holder;
		my $this = {};

		#initialize object with values
		if (@_) {
			&set(@_)
		}

		return bless $this, $type;
	}


Then the function call 

	$this->html_get_header ($headings{$action});

fails with the message

	"Can't call method "html_get_header" on unblessed reference"

Here's the code:

	sub display {
	# expects menu, list, new, review, update, preview
	# NULL should result in the help file being displayed!
		my $action = @_;

		my %headings = (menu => 'Main Menu', list => 'Accessible Articles', 
			new => 'Article Editing and Preview',
			review => 'Article Editing and Preview', 
			update => 'Article Editing and Preview', 
			preview => 'Article Editing and Preview');

		if ($action eq 'menu' ) {

			$this->html_get_header ($headings{$action});
		}

	 ... ETC
	}


And finally, my application's thread is controlled from within an object 
(which is created last -- all the objects are created within the main
package,
this is the only object with methods that 'fail')

The call to 

	$interface->display ('new');

also fails, returning the message 

	"Can't call method "display" without a package or object reference"



Regards,
Tim.



___________________________________________________________________________
Tim Malcolm (tel.415.694.4387)			  	     Synopsys, Inc. 
Software Engineer		               	   700 east Middlefied Road 
malcolm@ynopsys.COM                       	     Mountain View CA 94043 
http://hustle/~malcolm/                  	   http://www.synopsys.com/


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

Date: Thu, 6 Feb 1997 15:03:59 GMT
From: gardner@redfield.med.utoronto.ca (Kevin Gardner)
Subject: Re: Perl rand() function on solaris SPARC
Message-Id: <E56sIn.CA2@utcc.utoronto.ca>

Hi Paul:

Paul Austin (paustin@gw.ford.com) wrote:
: I am trying to use the rand() function to obtain a random number between
: 0 and 39. This works fine on a HP UX system but when I run it on
: solaris the numbers being returned are in the order of 100,000's
: any ideas why this occurs?
:
: The command I am using is:
:
: $index = int(rand(39));

Hmmm --- works fine on my setup (Perl 5.003; Solaris 2.5.1 / Sparc 2).
My initial guess is that your Solaris perl executable may have been
compiled with the incorrect value set for the number of bits produced
by the random number generator.  Any other ideas?

Kevin

--
*************************************************************************
Kevin Gardner                               gardner@bloch.med.utoronto.ca
University of Toronto             http://abragam.med.utoronto.ca/~gardner
Dept. of Medical Genetics & Microbiology   phone: 416-978-0642/FAX: -6885


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

Date: Thu, 06 Feb 1997 18:22:59 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Perl regexes are *not* greedy (was Pattern Matching Question)
Message-Id: <pudge-ya02408000R0602971822590001@news.idt.net>

tchrist@mox.perl.com (Tom Christiansen) wrote:
# Now we just need a book to illuminate perl's crooks and nannies. :-)

Is that legal in the U.S.?

#================================================================
I am not authorized to fire substitute teachers.

   --Bart Simpson

Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: Thu, 6 Feb 1997 22:51:26 GMT
From: gerlach@netcom.com (Matthew H. Gerlach)
Subject: Re: perl tcl extension
Message-Id: <gerlachE57E5q.GoD@netcom.com>

In article <5ddi3f$ro1$1@Mars.mcs.net> lchism@MCS.COM (Leon Chism) writes:
>can someone tell me where to find the perl 
>tcl extension? 
>
>Is there an extension specifically for expect ?
>
>thanks
>
>

Comm.pl at your nearest CPAN will do what expect does if you are running
on a fairly common UNIX.

Matthew



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

Date: 7 Feb 1997 00:27:41 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: printf and %
Message-Id: <5ddstt$9a6$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, "David & Kristen" <drwill@loginet.com> writes:
:But what I really want is the output to look like this:
:	Answer is 100.00 %
:with the % sign after it.  Obviously, printf thinks I'm trying to format
:something when I put the % sign after it so it's not working.  So I try
:prefixing the % sign with a backslash intending for PERL to understand I
:literally want a "%".  But it still doesn't work.
:
:Any suggestions?  Please e-mail!

I suggest you read what the perlfunc(1) man page says about printf,
which will tell you to see the sprintf definition, which will tell 
you to read the sprintf(3) man page, which will tell you to use a 
double percent sign.

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com


It's all magic.  :-)    --Larry Wall in <7282@jpl-devvax.JPL.NASA.GOV>


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

Date: 6 Feb 1997 21:56:27 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Script to Find-replace
Message-Id: <5ddk2b$87d@fridge-nf0.shore.net>

Keven D. Ficken (ficken@mobot.org) wrote:
: I am looking for a script that will search through all of the files in
: a directory tree and replace a specified character string with another

You might not have to comb the CPAN, if your distribution already
includes File::Find, and you take it from there.

HTH!

--
Nathan V. Patwardhan
nvp@shore.net
"Hello, good citizen.  I'm Batman.
Would you like to be my assistant?
Would you like to ride with me?
Would you like to ride with Batman?"


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

Date: Thu, 06 Feb 97 23:03:38 GMT
From: lewau@belsebub.ics.lu.se (Roger Lewau)
Subject: Sending results to two frames at once
Message-Id: <5ddo0l$haf@news.lth.se>


I don't know if this is possible at all but I have developed a script for an 
onlineshop and I need to update two frames with the result of the script. Is 
there a way to tell the browser in what frame it should display the output 
from the script from within perl?

//Roger


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

Date: Thu, 6 Feb 1997 15:36:37 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Daniel Fox <dfox@pobox.com>
Subject: Re: setuid()
Message-Id: <Pine.GSO.3.95.970206153254.28253A-100000@linda.teleport.com>

On Wed, 5 Feb 1997, Daniel Fox wrote:

> Is there a way to change the uid of a perl program
> like setuid() in C?

Yes. perlvar(1) documents the four special variables $< , $> , $( , and $) 
which make it possible. 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/



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

Date: Thu, 6 Feb 1997 23:53:43 GMT
From: khughes@netcom.com (Kirby Hughes)
Subject: Re: Shell "case" command in perl
Message-Id: <khughesE57H1J.DMx@netcom.com>

In article <memo.970204191027.7271B@zetnet.co.uk> neilb@zetnet.co.uk (Neil S. Briscoe) writes:
:In article <E51ooo.4AC@nonexistent.com>, abigail@ny.fnx.com (Abigail)
:wrote:
:
:> foreach ($test) {
:>     /foo/     and do {something; last;};
:>     default things to do;
:> }
:
:That isn't a switch thats an iteration.  Heres a Perl switch :-
:

It's not really an iteration, more of a common idiom using foreach's
aliasing capability to make a temporary assignment to $_ for convenient
matching.

For more info see page 105 of Camel 2nd ed.

-Kirby Hughes


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

Date: Thu, 06 Feb 1997 15:55:49 -0800
From: Roger Smith <rsmith@proteus.arc.nasa.gov>
Subject: sybperl for the MacIntosh ?
Message-Id: <32FA6F85.7BF9@proteus.arc.nasa.gov>

Greetings All

I just joined this list, so my apologies if this question has been asked
in the past (although I did a search back through november).

We are looking for a perl interface to the MacIntosh Sybase client. We
have the client package and the developers package which includes a c
library interface. I have visited the mac-perl web sites for both
distribution and faq, searching for references tosybase or sybperl, but
with no success.

Can someone please shed some light on this?

Cheers,

Roger Smith,
NASA-Ames Research center


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

Date: 7 Feb 1997 00:23:24 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Using exec-Why won't this work?
Message-Id: <5ddsls$998$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    "D.M. Johnson" <ez045864@peseta.ucdavis.edu> writes:
:I am using exec to run a spell function.  I know that it works because if
:$pass is spelled wrong then it is put into the file "temp".  However, I
:can't read it into $word, nor can I execute any print statement after the
:exec call.  Why???  Thanks in advance.

It probably has something to do with your not reading what 
the perlfunc man page says about the exec() call, not to 
mention what the perltrap man page says about the -w switch.

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com

    "They'll get my perl when they pry it from my cold, dead /usr/local/bin."
	    Randy Futor in  <1992Sep13.175035.5623@tc.fluke.COM>


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

Date: 6 Feb 97 18:09:09 -0800
From: mcdan3@msn.com (Brian Mc Daniel)
Subject: Wanted NT Perl Script
Message-Id: <00006099+000079b8@msn.com>


I am looking for a Perl script that can check the creation dates on 
existing files in a directory to determine if they are older than 1 
week and if so to go ahead and remove them.

Many Thanks


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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 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.

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 V7 Issue 908
*************************************

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