[7285] in Perl-Users-Digest
Perl-Users Digest, Issue: 910 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 23 14:17:12 1997
Date: Sat, 23 Aug 97 11:00:25 -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 Sat, 23 Aug 1997 Volume: 8 Number: 910
Today's topics:
Re: Building a (very?) complex data structure.... (Toutatis)
Re: Building a (very?) complex data structure.... <zenin@best.com>
Re: Changing a URL from a perl script (Jeremy D. Zawodny)
Crypt::IDEA and blocksize <chris@ixlabs.com>
Die without diagnostics message <vba@knoll.hibu.no>
Re: Directory searching (Jeremy D. Zawodny)
Error running Perl Script <amerar@unsu.com>
Exception Handling in OO Perl <ajiteshd@wiproge.med.ge.com>
Re: Getting index of array element (Tad McClellan)
Re: Hailp! Hailp! (Dick)
Re: hel[p (Jeremy D. Zawodny)
Help on Final Exam (Perl class) <mre@emerald.compata.com>
help wanted (Marcine Uhler)
Help: Compiling Perl <amerar@unsu.com>
Re: Help: Compiling Perl (Simon Hyde)
Re: How do I drop trailing spaces? (Bart Lateur)
Re: incredibly simple question (the Thief of Always)
Re: is there a perl compiler ported to NT? (Alan Strassberg)
List of perl books, which one should I buy? <jaydee@worsdall.demon.co.uk>
Re: List of perl books, which one should I buy? <jeff@webdesigns1.com>
mixing hexadecimal and strings (John Nielsen)
Re: mixing hexadecimal and strings (John Nielsen)
Re: Passing multiple arrays to subroutine ??? (Andrew M. Langmead)
Re: PERL & WinNT (Jeremy D. Zawodny)
Re: Perl Conference presentations on paper? (Jeremy D. Zawodny)
Perl Directory <j5rson@ic.mankato.mn.us>
Re: podman in Win32 (Danny Aldham)
Q: get class at runtime and instantiate? <jhall@SPAMAWAY.tahiti.umhc.umn.edu>
rand() does not work, HELP (Hedin Meitil)
Setting subject in emails (Dan_Margalit)
Re: Win32 Error: 193 using Perl for Win32 (Jeremy D. Zawodny)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Aug 1997 07:54:03 GMT
From: toutatis@remove.this.toutatis.net (Toutatis)
Subject: Re: Building a (very?) complex data structure....
Message-Id: <toutatis-ya023180002308970954020001@news.euro.net>
In article <5tlhdj$7rg$2@nntp2.ba.best.com>, Zenin <zenin@best.com> wrote:
> [posted & mailed]
(You probably did not remove the spamtrap from the emailaddress.)
> Toutatis <toutatis@remove.this.toutatis.net> wrote:
> > I am trying to build a sorted data structure, just like directories, in
a single
> > reference, but without any luck so far.
> > my $data = {"food-fruit-apple" => $object1,
> > "food-meat-pork" => $object2,
> > "food-meat" => $object3,
> > "clothing" => $object4};
> >snip<
<cut>
> ## Or probably better done as...
>
> my $data = {};
> $data->{food}{fruit}{apple} = $object1;
> $data->{food}{meat}{pork} = $object2;
> ## $data->{food}{meat} = $object3; ## Don't do this (see below)
> $data->{clothing} = $object4;
>
> Notice that "food-meat => $object" is not there. The first use of
> food-meat is a reference to a hash that contains pork. If you were
Thank you for trying to help, but allowing to store objects halfway
the datastructure is crucial. Just like a directory structure on a file-
system can have subdirectories and files in it.
--
Toutatis
------------------------------
Date: 23 Aug 1997 13:32:44 GMT
From: Zenin <zenin@best.com>
Subject: Re: Building a (very?) complex data structure....
Message-Id: <5tmops$mrt$3@nntp2.ba.best.com>
[posted & mailed]
Toutatis <toutatis@remove.this.toutatis.net> wrote:
> > [posted & mailed]
> (You probably did not remove the spamtrap from the emailaddress.)
DuH! :^) Funny, didn't bounce...
> Thank you for trying to help, but allowing to store objects halfway
> the datastructure is crucial. Just like a directory structure on a file-
> system can have subdirectories and files in it.
You can do something similar to a directory stucture, however even
in a file system, a file can not be a directory file and plain
file at the same time. :)
For example, we'll map your set as a directory and files
file /food/fruit/apple (contains object1 data)
file /food/meat/pork (contains object2 data)
dir /food/meat (contains object3 data? It's already a
directory...right?)
file /clothing (contains object4 data)
See how that doesn't work? :) For the meat level to contain a pork
key, it *must* have a value that is a hash reference that contains
the pork key. It's the same as a file system, and infact maping a
file system to a perl data stucture isn't hard at all.
Now, if you wanted a /food/meat/README.txt file you could in both
the file system and in a perl5 stucture, or even a /food/meat.txt.
Hope this is a little more clear.
--
-Zenin
zenin@best.com
------------------------------
Date: Sat, 23 Aug 1997 17:45:23 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Changing a URL from a perl script
Message-Id: <33ff20f8.514216804@news.bgsu.edu>
[original author automagically cc'd via e-mail]
On 18 Aug 1997 19:03:52 GMT, sull@au8.ecn.purdue.edu (Keith Sullivan)
wrote:
>I am having trouble changing the URL from a perl script. What I want to
>happen is the following: a user answers a question, and they are taken
>to one of two locations. The new location depends on the answer to the
>question. The question is a simple form which utilizes two radio buttons.
[really long line snipped]
Yikes. Fix your newsreader so that it knowns how to wrap lines...
>#! /usr/local/bin/perl
>
>require 'cgi-bin.pl';
>&ReadParse (*in);
>
>MAIN: {
> if ($in{'ferttype'} eq "dry") {
> print "Location: http://pasture.ecn.purdue.edu/~sull/assess/fert/dry.htm\n\n";
> exit; }
>
> else {
> print "Location: http://pasture.ecn.purdue.edu/~sull/assess/fert/liquid.htm\n\n";
> exit;}
>
>}
>
>Any help would be appreciated.
Eww... Okay, simplifiy your life by downloading and using CGI.pm from
you local CPAN site.
Then, something like:
#!/usr/local/bin/perl
use strict;
use CGI;
my $query = new CGI;
if ($query->param("ferttype") eq "dry) {
print $query->redirect("http://foo.bar.com/blah.html");
} else {
print $query->redirect("http://foo2.bar2.com/blah2.html");
}
exit;
Good Luck,
Jeremy
---
Jeremy D. Zawodny
WCNet Technical Geek & Web Stuff
<URL:http://www.wcnet.org/~jzawodn/>
"That's an example of how Perl can bring school yard cruelty to new heights."
-- Jon Orwant at the 1st Annual Perl Conference
------------------------------
Date: Fri, 22 Aug 1997 23:13:44 -0700
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: Crypt::IDEA and blocksize
Message-Id: <33FE7F98.178E@ixlabs.com>
Am I nuts, or can Crypt::IDEA only encrypt 8 bytes of data.
There seems no way in the interface to override this.
Why is it like this?
------------------------------
Date: Sat, 23 Aug 1997 17:23:43 +0200
From: Vegard Bakke <vba@knoll.hibu.no>
Subject: Die without diagnostics message
Message-Id: <33FF007F.D97@knoll.hibu.no>
I really would like to use the diagnostics module in my scripts.
Still, I'd like to 'die' without any additional diagnostics messages.
Since I don't know whether the calling script has used diagnostics,
'disable diagnostics' isn't the solution.
Are there any good ways around this?
Vegard
--
Vegard Bakke,
vegard.bakke@hibu.no
Kirkegata 9, 3600 Kongsberg, Norway
"My spelling is Wobbly. It's good spelling but it Wobbles,
and the letters get in the wrong places." -- Winnie the Pooh
------------------------------
Date: Sat, 23 Aug 1997 17:32:11 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Directory searching
Message-Id: <33ff1d5d.513293046@news.bgsu.edu>
[original author automagically cc'd via e-mail]
On Sun, 17 Aug 1997 13:16:31 -0400, Anne Kumar <annek@nortel.ca>
wrote:
>I was wondering if there was anyway to search hierarchically through
>directories and replace items in those files. I've tried the chdir and
>opendir but they seem to only work with one subdirectory and no other
>directories below that level. If you have any suggestions please let
>me know.
Two suggestions.
If you're gonna use chdir() and opendir(), it *ought* to work.
You should be doing something like this (the exact idea will change
depending on the type of search you want: depth-first, etc.):
This *is* psudeocode:
sub blah {
chdir(shift)
opendir();
read entries;
foreach $dir {
if it's a file
process it
else
push it onto a @dirs stack
}
foreach $dir (@dirs) {
blah($dir)
}
}
You'll have to tinker with something like that.
On the other hand, rather than debugging recursive directory-walking
routines (which I get sick of quickly), visit your local CPAN site and
pick up a copy of File::Find if you don't already have it.
Jeremy
---
Jeremy D. Zawodny
WCNet Technical Geek & Web Stuff
<URL:http://www.wcnet.org/~jzawodn/>
"That's an example of how Perl can bring school yard cruelty to new heights."
-- Jon Orwant at the 1st Annual Perl Conference
------------------------------
Date: Sat, 23 Aug 1997 10:58:03 -0500
From: Arthur Merar <amerar@unsu.com>
Subject: Error running Perl Script
Message-Id: <33FF088B.54DD@unsu.com>
Hello,
When I try to run my perl script from my web page, I get this error
message:
exec of /usr/local/www/htdocs/clients/unsu/cgi-bin/trivia.pl failed,
reason: Text file busy (errno = 26)
It runs fine from the shell.......what does this error mean? The rights
on the file are -rwxr-xr-x, and I do not open it for output.
--
Thanks,
Arthur
amerar@unsu.com
http://www.unsu.com
------------------------------
Date: Fri, 22 Aug 1997 11:08:51 -0530
From: Ajitesh Das <ajiteshd@wiproge.med.ge.com>
Subject: Exception Handling in OO Perl
Message-Id: <33FDC09B.167E@wiproge.med.ge.com>
Hi All,
I am currently scriptin' a "Internet Showcase" script.
where I came in to a situation to USE EXCEPTION HANDLER
in OO-PERL.
Does anybody has any sample script or know some site location
relating to that?
Thanks for your help in advance
Rgds
Ajitesh
[ p.s: During posting ur reply pl mail me a
copy ]
----
Ajitesh Das ajiteshd@wiproge.med.ge.com
---
"Golden Rule: never derive from a concrete class "
------------------------------
Date: Sat, 23 Aug 1997 06:16:52 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Getting index of array element
Message-Id: <4rgmt5.cn.ln@localhost>
Eric Penn (stupid@wco.com) wrote:
: Let's suppose that I have an array of unique values.
^^^^^^^^^^^^^
Do you mean truly unique (ie. no duplicate values)?
(0,1,2,0,8) cannot ever happen?
Or just 'distinct' (allows duplicate values)?
Since you said unique, my algorithm can depend on them being unique ;-)
You can use a hash where the 'unique value' is the key,
and the ordered index is the value:
-------------------------
#!/usr/bin/perl -w
@ary = qw(zero one two three four five);
for ($i=0; $i<@ary; $i++) { # do this part once in the program
$ary{$ary[$i]} = $i;
}
foreach (@ary) { # do this to get each index
print "The index of '$_' is $ary{$_}\n";
}
-------------------------
You might also want to see this Frequently Asked Question in
the Perl FAQ, part 4:
"How can I tell whether an array contains a certain element?"
: The order of the
: values in significant. Now, say I'd like to find the index of one value in
: the array. The way I've come up with is a brute force search, which to me
: seems both ugly and slow:
[ snip linear search code ]
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 23 Aug 1997 15:39:59 GMT
From: nospam.dickc@oz.net (Dick)
Subject: Re: Hailp! Hailp!
Message-Id: <5tn092$5pc$1@hourglass.oz.net>
In article <33FAD583.8A96D4F6@glaxowellcome.com>, Thad Welch <tw36027@glaxowellcome.com> wrote:
>I would go to site,
>
>http://www.activeware.com/
That's the one I'm running.
>Hiawatha Bray wrote:
>> I'm trying to teach myself Perl with a book from Waite Press. Came
>> with a
>> CD-ROM with Perl 5.001 on it. But I can't get it to run on my Win 95
>> computer. I can get the program PERL.EXE to fire up, but it won't run
>> the
>> basic Hello World program. It just sits there. Throws an error
>> message
>> once in awhile, but I don't understand how to get it to work. What
>> command
I put the path to Perl in the autoexec.bat file. And then open up a dos window
and type perl file.pl.
Works fine for me.
>>
>> pretensions, the book seems to have been written as if everyone uses
>> Unix.
>> There doesn't seem to be any Win 95-specific info on how you get Perl
>> to
>> work. Please, somebody, e-mail me! I'm at wathab@tiac.net. Thanks.
Perl is a recent port to Windows. And the majority of people running perl
do it on unix machines. However, with just a little translation you can
convert the explanations to dos. Just remember that the back slashes used
to seperate directories in dos are front slashes in unix. And you need to
make .bat files in dos to make things run like an executable.
However, by putting Perl in the path in the autoexec.bat file, all you have
to do is type perl file.pl and it should run fine.
Included with the version of Perl I received are a couple of sample programs
that open up Excel, put in information and then generate a chart. Pretty neat.
And the info that comes with Perl for windows does contain information on
Win95 and NT.
Dick
dickc@oz.net
------------------------------
Date: Sat, 23 Aug 1997 17:33:33 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: hel[p
Message-Id: <33ff1eca.513658041@news.bgsu.edu>
[original author automagically cc'd via e-mail]
On Sun, 17 Aug 1997 16:52:16 -0400, "Brian P. Moffatt"
<mudd97@nac.net> wrote:
>How can I test perl scripts on my win95 machine.
Well, if you'd read the FAQ, you'd already know the answer.
So, I'll give you a hint.
Go to http://www.activestate.com/ and pick up a copy of Perl for
Win32.
Jeremy
---
Jeremy D. Zawodny
WCNet Technical Geek & Web Stuff
<URL:http://www.wcnet.org/~jzawodn/>
"That's an example of how Perl can bring school yard cruelty to new heights."
-- Jon Orwant at the 1st Annual Perl Conference
------------------------------
Date: 22 Aug 1997 22:36:57 -0700
From: Mike Elliott <mre@emerald.compata.com>
Subject: Help on Final Exam (Perl class)
Message-Id: <87d8n5sbnq.fsf@emerald.compata.com>
I'm going to be teaching a ten-week Programming in Perl class next
year, and I'd like to make the Final Exam a Perl project. As this is
University Extension, I can't expect more than perhaps 30 to 40 total
hours (per student) expended on it spread out over the quarter.
What I'm looking for are suggestions as to what the problem should be.
Besides the time constraint mentioned above, it should be something
which is relatively platform independent -- that is, I think I have to
accommodate bone-heads who insist on using Microsoft operating
systems.
Any suggestions welcome --
Mike Elliott
------------------------------
Date: Sat, 23 Aug 1997 05:32:58 -0700
From: mrt1@webtv.net (Marcine Uhler)
Subject: help wanted
Message-Id: <5tml9q$6vr$1@newsd-199.bryant.webtv.net>
i am seeking a perl script writer to assist me in developing an
interactive online perl program for database please e mail me at
mrt1@webtv.net or call i am based in so cal this project would be
parttime
Marc R. Tow
(714) 975-0544 office
(714) 975-0547 office fax
------------------------------
Date: Fri, 22 Aug 1997 22:29:23 -0500
From: Arthur Merar <amerar@unsu.com>
Subject: Help: Compiling Perl
Message-Id: <33FE5913.4E44@unsu.com>
Is there a way to compile a perl program in order to check the syntax???
--
Thanks,
Arthur
amerar@unsu.com
http://www.unsu.com
------------------------------
Date: Sat, 23 Aug 1997 09:52:22 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: Help: Compiling Perl
Message-Id: <33feb2be.4267970@news>
On Fri, 22 Aug 1997 22:29:23 -0500, Arthur Merar <amerar@unsu.com> wrote:
>Is there a way to compile a perl program in order to check the syntax???
perl -c file
------------------------------
Date: Sat, 23 Aug 1997 11:34:59 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: How do I drop trailing spaces?
Message-Id: <340cc1b2.8051236@news.tornado.be>
Bernard Gibbons <bernard510@hotmail.com> wrote:
>I have a text string in $name and while I know it is no longer than 40
>characters I don't know how many of these are trailing spaces.
Apart from the solution in the FAQ,
$name=~s/\s+$//;
this is another possibility:
$name = unpack('A*',$name);
>From the decription of "pack" in perlfunc.pod:
A * for the repeat count means to use however many items are
left. The "a" and "A" types gobble just one value, but pack it
as a string of length count, padding with nulls or spaces as
necessary. (When unpacking, "A" strips trailing spaces and
nulls, but "a" does not.)
HTH,
Bart.
------------------------------
Date: 23 Aug 1997 06:23:17 GMT
From: omard@blue.seas.upenn.edu (the Thief of Always)
Subject: Re: incredibly simple question
Message-Id: <5tlvkl$fq1$1@netnews.upenn.edu>
Eike Grote (eike.grote@theo.phy.uni-bayreuth.de) wrote:
: Hi,
: Philip A. Viton wrote:
: >
: > print STDERR "\nPlease answer Y or N: ";
: > $resp=<STDIN>;
: > if ($resp = ~ /^[yY]+/)
: ^^^
: this must be ONE operator: =~
: > { print STDERR "Your response was Y\n" }
: > else
: > {print STDERR "Your response wasn't Y\n" }
wow perl has an else statement.
go figure.
omard
: Bye, Eike
: --
: ======================================================================
: Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
: ----------------------------------------------------------------------
: e-mail -> eike.grote@theo.phy.uni-bayreuth.de
: WWW -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html
: http://www.phy.uni-bayreuth.de/~btpa25/
: ======================================================================
--
Never take a strangers advice, Never let a friend fool you twice,
Never be the first to believe, never be the last to deceive...
____________The City of Suffering_____________ omard@eniac.seas.upenn.edu
http://www.seas.upenn.edu/~omard/welcome.shtml shade@resurrection.com
------------------------------
Date: 23 Aug 1997 09:36:52 -0700
From: alan@bali.seg.wj.com (Alan Strassberg)
Subject: Re: is there a perl compiler ported to NT?
Message-Id: <5tn3j4$1f3@bali.seg.wj.com>
In article <Pine.OSF.3.96.970822115644.31017A-100000@saul9.u.washington.edu>,
Y Chen <yinso@u.washington.edu> wrote:
>Hello,
>
>got a question for all you perl gurus out there... do you know whether or
>not Mr. Malcolm Beattie's compiler has been ported to NT? I have run the
>compiler under unix, however, I can't find one for NT yet. If someone can
>let me know where to find information about it, I will be grateful :)
According to O'Reilly the NT Perl compiler is due Q1 1998.
alan
--
alan@wj.com
------------------------------
Date: Sat, 23 Aug 1997 13:03:58 +0100
From: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: List of perl books, which one should I buy?
Message-Id: <OwMPLfAuGt$zEwe2@worsdall.demon.co.uk>
Can anyone give recommendations to any of these books before I invest in
one? I need one that will take me from the querky //^$_ FUNNY characts
and what the mean/how they work, through to full ng. Also earn by
hacking codes together and seeing what they do so good WORKING examples
will be useful.
13330 Perl By Example
10873 Learning Perl
28682 Applied Perl: Internet Programing With Perl
26794 Perl 5 Quick Reference
28288 Perl 5 for Dummies
26841 Perl 5 by Example
Please I am not rich so no saying get the lot. I have a large family of
underpants to support! 16 in fact, increasing due to birthday and Xmas
is looming!
--
Mark Worsdall - Oh no, I've run out of underpants :(
Home:- jaydee@worsdall.demon.co.uk WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmaster@shadow.org.uk WEB site:- http://www.shadow.org.uk
------------------------------
Date: Sat, 23 Aug 1997 12:24:54 -0500
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Re: List of perl books, which one should I buy?
Message-Id: <5tn66s$8i9@newsops.execpc.com>
I have some info on my Perl Primer web site
http://www.webdesigns1.com/perl/books.html
and on that page you can find a link to Tom Christiansen's
Camel Critiques which is much more complete and detailed.
Although I just tried to go to his page and it gave me a 404
File Not Found.
Go to
http://reference.perl.com/query.cgi?books
for now which is also a good source and maybe the Camel Critiques
will show up again. They've been reorganizing the site.
Jeff Oien, WebDesigns
http://www.webdesigns1.com/
jeff@webdesigns1.com
Mark Worsdall wrote in article ...
>Can anyone give recommendations to any of these books before I invest in
>one? I need one that will take me from the querky //^$_ FUNNY characts
>and what the mean/how they work, through to full ng. Also earn by
>hacking codes together and seeing what they do so good WORKING examples
>will be useful.
>
>13330 Perl By Example
>10873 Learning Perl
>28682 Applied Perl: Internet Programing With Perl
>26794 Perl 5 Quick Reference
>28288 Perl 5 for Dummies
>26841 Perl 5 by Example
>
>Please I am not rich so no saying get the lot. I have a large family of
>underpants to support! 16 in fact, increasing due to birthday and Xmas
>is looming!
>
>--
>Mark Worsdall - Oh no, I've run out of underpants :(
>Home:- jaydee@worsdall.demon.co.uk WEB site:-
http://www.worsdall.demon.co.uk
>Shadow:- webmaster@shadow.org.uk WEB site:- http://www.shadow.org.uk
------------------------------
Date: 23 Aug 1997 11:11:46 -0400
From: jnielsen@chemistry.mps.ohio-state.edu (John Nielsen)
Subject: mixing hexadecimal and strings
Message-Id: <5tmuji$b2f@chemistry.ohio-state.edu>
The result I get from this code, doesn't make sense to me:
$a="\x"."3f";
$b="\x3f";
if ($a == $b ) {print "They are equal $a $b\n";}
else {print "They are not equal $a $b\n";}
When I run it I get:
They are equal 3f ?
It looks to me like $a is a string and $b a hexidecimal number. They
shouldn't be equal.
On a similar note,
If you have a string "3f" stored in a variable, how do you convert it
to a hexadecimal number stored in a variable.
Let's say I have a number like 15, I use sprintf to convert it to a string
representation of it's hex equivalent, how do I get the hex representation?
$number="15";
$c = sprintf '%lx',$number;
Now I have a string with the letter f, when I really wanted \xf.
How do I get \xf?
Pack/unpack with H for hex, doesn't seem to help either.
Any ideas . . .
john
------------------------------
Date: 23 Aug 1997 11:43:54 -0400
From: jnielsen@chemistry.mps.ohio-state.edu (John Nielsen)
Subject: Re: mixing hexadecimal and strings
Message-Id: <5tn0fq$bnt@chemistry.ohio-state.edu>
I figured it out, of course, minutes after I sent it.
$a=pack "c","63";
Will give you an unsigned character which is effectively the same
as setting something equal to:
$a = "\0x3f";
john
In article <5tmuji$b2f@chemistry.ohio-state.edu>,
John Nielsen <jnielsen@chemistry.mps.ohio-state.edu> wrote:
>
>The result I get from this code, doesn't make sense to me:
>
>
>
>$a="\x"."3f";
>$b="\x3f";
>if ($a == $b ) {print "They are equal $a $b\n";}
>else {print "They are not equal $a $b\n";}
>
>
>When I run it I get:
>
>They are equal 3f ?
>
>
>It looks to me like $a is a string and $b a hexidecimal number. They
>shouldn't be equal.
>
>On a similar note,
>
>If you have a string "3f" stored in a variable, how do you convert it
>to a hexadecimal number stored in a variable.
>
>Let's say I have a number like 15, I use sprintf to convert it to a string
>representation of it's hex equivalent, how do I get the hex representation?
>
>$number="15";
>$c = sprintf '%lx',$number;
>
>Now I have a string with the letter f, when I really wanted \xf.
>
>How do I get \xf?
>
>Pack/unpack with H for hex, doesn't seem to help either.
>
>Any ideas . . .
>
>john
------------------------------
Date: Tue, 19 Aug 1997 22:38:29 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Passing multiple arrays to subroutine ???
Message-Id: <EF6Mw6.86G@world.std.com>
"James H. Blackwell" <jim.blackwell@gsfc.nasa.gov> writes:
>Hi all,
>Before I go completely gaa gaa, I thought I'd ask the question in hopes
>that someone can help me.
>I have a subroutine that gets passed to it a number of arrays.
>my_routine(@arr1, @arr2, @arr3)
>In the subroutine, I do this:
>sub my_routine {
> my (@ar1, @ar2, @ar3) = @_;
When a comma separated group of lists gets evaluated in a list
context, they get flatted into one large list.
@all = (@arr1, @arr2, 1 .. 10, @arr3);
When you pass an list to a subroutine, it evaluates all of these lists
in a list context, and then all of the elements of all of the lists
get aliased as elements of the @_ array.
The easiest way of handling things is to pass references to the arrays
as you have shown:
>my_routine(\@arr1, \@arr2, \@arr3)
but you have to handle them in your subroutine specially. What is in @_
are scalar variables, which contain a reference to the original
array. Essentially, special info to tell perl where the array really
is.
sub my_routine {
my ($ar_ref1, $ar_ref2, $ar_ref3) = @_;
and when you want perl to manipulate the real array, you have to
dereference it to tell perl that you are not talking about the scalar
that holds the reference, but the array that it points to.
push @{$ar_ref1}, shift @{$ar_ref2};
The perlref and perldsc man page contain useful information about
references. The perlref man page is rather heavy reading, but contains
the primary information that you need to know. The perldsc man page is
a bit easier going, (and the COMMON MISTAKE section is extremely
helpful) but presumes knowledge contained in perlref.
--
Andrew Langmead
------------------------------
Date: Sat, 23 Aug 1997 17:25:54 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: PERL & WinNT
Message-Id: <33ff1cf8.513192071@news.bgsu.edu>
[original author automagically cc'd via e-mail]
On Fri, 22 Aug 1997 12:46:16 -0400, Greg Hassan <gwhassan@prodigy.net>
wrote:
>Eduardo da Fonseca Melo wrote:
[snip]
>> HTTP/1.0 403 Access Forbidden (Read Access Denied -
>> This Virtual Directory does not allow objects to be read.)
>>
>> What's even more strange is that the same code works in another WinNT
>> server as you can see in www.mundi.com.br/scripts/direfm.pl
>>
>> What should we do in order to make to script work?
>
>if it works on another server and you get that error, I would say that
>you
>don't have perl setup correctly on your server. Do you have other
>perl scripts running in that directory with the ext. .pl?
I beg to differ. It sounds like a permissions problem to me.
Isn't that what the error message sounds like?
>if not then you should problem just go to activeware's web site
>and redownload their version of perl.
FYI, ActiveWare is now ActiveState.
Jeremy
---
Jeremy D. Zawodny
WCNet Technical Geek & Web Stuff
<URL:http://www.wcnet.org/~jzawodn/>
"That's an example of how Perl can bring school yard cruelty to new heights."
-- Jon Orwant at the 1st Annual Perl Conference
------------------------------
Date: Sat, 23 Aug 1997 17:36:32 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Perl Conference presentations on paper?
Message-Id: <33ff1f52.513794607@news.bgsu.edu>
[original author automagically cc'd via e-mail]
On Mon, 18 Aug 1997 07:07:42 GMT, adelton@fi.muni.cz (Honza Pazdziora)
wrote:
>Hallo,
>
>I will be coming to the U.S. this week, unfortunately few days late to
>catch the Perl Conference. Will there be any publication with the
>presentations from Perl Conference?
Yes.
Keep your eyes on http://www.perl.com/ for more info. Tim O'Reilly and
several others said that the materials would be going on-line.
Many of the presenters have already put their materials on-line, but
there's not comprehensive index (yet).
Jeremy
---
Jeremy D. Zawodny
WCNet Technical Geek & Web Stuff
<URL:http://www.wcnet.org/~jzawodn/>
"That's an example of how Perl can bring school yard cruelty to new heights."
-- Jon Orwant at the 1st Annual Perl Conference
------------------------------
Date: Sat, 23 Aug 1997 00:58:53 -0500
From: "Jeffrey D. Iverson" <j5rson@ic.mankato.mn.us>
Subject: Perl Directory
Message-Id: <33FE7C1D.3ECD@ic.mankato.mn.us>
At http://www.iversonsoftware.com/perl.html we've created a FREE online
directory of professional consultants and developers for Perl. We
currently have 37 entries.
You'll also find a job board where you can see opportunities for work, a
discussion board where you can post questions or find answers, and a
bookstore.
I hope you'll visit soon!
--
Jeffrey D. Iverson j5rson@iversonsoftware.com
Iverson Software Co. http://iversonsoftware.com/
------------------------------
Date: 22 Aug 1997 22:52:14 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: podman in Win32
Message-Id: <5tltqe$afc$1@lennon.postino.com>
Sergio Stateri Jr (serginho@mail.serve.com) wrote:
: Hi! Is there any way to create the man pages in Win32 ?
: thanks in advance!
Sure, but there is no man command on NT. Try running the
pod2text script, or pod2html , in the pod directory of the
source. It will generate decent man pages, that you can then
read with type, cat, or notepad.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: Sat, 23 Aug 1997 10:15:48 -0500
From: Jeff Hallgren <jhall@SPAMAWAY.tahiti.umhc.umn.edu>
Subject: Q: get class at runtime and instantiate?
Message-Id: <33FEF094.B12B0C37@SPAMAWAY.tahiti.umhc.umn.edu>
I want to "use" a class whose name is in a string and then
instantiate an object of that class... I can't get this to work.
What I have below is apparently way off but it should demonstrate
the idea...
Help/documentation pointers apprieciated. I've seen runtime
method invocations but nothing on classForName() operations.
Jeff
# assuming Custom/IOGuy.pm exits
my $class = "Custom::IOGuy"; # name possibly from database
my $obj = $objDealer->returnAnObjectFor($class);
...
...
sub returnAnObjectFor {
my $self = shift;
my $class = shift;
require $class;
return new $class();
}
--
Jeff
jhall@SPAMAWAY.tahiti.umhc.umn.edu
------------------------------
Date: Thu, 21 Aug 1997 21:50:39 GMT
From: hm@NO-SPAMroyal.net (Hedin Meitil)
Subject: rand() does not work, HELP
Message-Id: <33fcb3d5.2939342@news.dknet.dk>
I can't get the rand() function to return values higher than 1. Or in
fact when I set the upper limit to 100, the highest returned value is
0.0013.... Of course if I set the limit to 100000, I get values higher
than 1, but...
MY CODE IS OK!: I've tried to run a script from the book "Teach
yourself perl in 21 days", directly from the accompanying CD-rom. Same
result.
Is there a solution to my problem? I run perl 4.
- Hedin
------------------------------
Date: 23 Aug 1997 16:07:55 GMT
From: Dan_Margalit@brown.edu (Dan_Margalit)
Subject: Setting subject in emails
Message-Id: <5tn1sr$799@cocoa.brown.edu>
Dear Perl group,
Can anyone tell me how to send an email with a specific subject from
perl? For example, when I receive an automatically sent email from one of my
web sites, I want to know whether it is a tutor application, a student
questionnaire, etc... so it would be nice if I could just put this in the
subject of the automatic email and then have it filtered by my email program.
Please email me (juggler@brown.edu) if you can help, as I do not
frequent this newsgroup. Thank you very much.
Sincerely,
Dan Margalit.
------------------------------
Date: Sat, 23 Aug 1997 17:51:29 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Win32 Error: 193 using Perl for Win32
Message-Id: <33ff22fa.514730162@news.bgsu.edu>
[original author automagically cc'd via e-mail]
On Wed, 20 Aug 1997 17:18:41 +0200, Anders Mork
<anders@comet.brussels.hp.com> wrote:
>I have tried to install Perl for Win32 to use with an AOLserver and I
>keep getting Win32 Error: 193 when I check the server log after having
>tried to execute a perl script that works just fine from the command
>line.
>
>Where can I find a list of error messages and their meaning for Perl for
>Win32 and is there anybody that has experienced the same problems with
>an AOLserver?
That doesn't sound like a Perl error at all to me. I'd suspect
something in your "AOLserver" software.
Jeremy
---
Jeremy D. Zawodny
WCNet Technical Geek & Web Stuff
<URL:http://www.wcnet.org/~jzawodn/>
"That's an example of how Perl can bring school yard cruelty to new heights."
-- Jon Orwant at the 1st Annual Perl Conference
------------------------------
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 910
*************************************