[10355] in Perl-Users-Digest
Perl-Users Digest, Issue: 3948 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 11 19:07:27 1998
Date: Sun, 11 Oct 98 16:00:27 -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 Sun, 11 Oct 1998 Volume: 8 Number: 3948
Today's topics:
.htaccess Problem <juha@crec08.bus.utexas.edu>
Re: adding to the @INC at install time (Martien Verbruggen)
Re: Any List of Win32 Error Codes ? <kbandes@home.com>
Any possible way to do graphics in perl?? <rbank@csf.edu>
Re: anyone got a rtf->html converter in perl? (Bart Lateur)
Re: Are there any "perl.newbie" group or forum? <mp@mkt2mkt.com>
Re: Assigning a value to a var (Michael Rubenstein)
Re: Can I FORMAT variables to be a specific length? (Bart Lateur)
Re: Can't send mail via telnet programmatically <nat@apart.net>
Re: Date:::Manip, Time::Zone, - localtime() off by 1 Ho (Sean McKenna)
Re: Date:::Manip, Time::Zone, - localtime() off by 1 Ho (Sean McKenna)
fading text <bravo@bravodesign.com>
Re: Help with this code <rra@stanford.edu>
How to post a multipart mime format in Perl ? sbernard@mail.esiea.fr
Re: I'm looking for someone who wants to write a comple (David A. Black)
Is there any way to compile perl scripts? <rbank@csf.edu>
Re: mSQL and DBI Problem in PERL (Martien Verbruggen)
Re: NETWORK & GRAPHIC CARD INFO (Martien Verbruggen)
Re: Newbie: using strict with filehandles (George Defenbaugh)
Re: Newbie: using strict with filehandles <garry@america.net>
Re: Newbie: using strict with filehandles <garry@america.net>
passing environment variables to sh or ksh script <chr0n0s@toosexyforyou.com>
Re: passing environment variables to sh or ksh script <rra@stanford.edu>
performing calculations on form entries <seanr@zapinc.com>
Re: Perl Robots (Timothy P O'Neill)
Re: Please help with time... <waltman@netaxs.com>
Re: read subdirectories (Martien Verbruggen)
Re: symlinks and perl (Martien Verbruggen)
Re: Syntax error <rbank@csf.edu>
Troubles calling Perl from C (Jete Software Inc.)
Re: Whole Random number? <rbank@csf.edu>
Re: Why it doesn't work under UNIX?????? <rra@stanford.edu>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 11 Oct 1998 16:32:25 -0500
From: Juha Vehnia <juha@crec08.bus.utexas.edu>
Subject: .htaccess Problem
Message-Id: <362123E8.1C1BF1C1@crec08.bus.utexas.edu>
We are using perl to dynamically generate Apache's (user authentication)
.passwd file when ever new users registerer to use our system. We don't
use any file locking or anything, we just generate tmp file and then
replace the original .passwd file with the new file. There is a problem,
the whole .passwd file gets somehow corrupted and nobody can login. This
happens like 2 or 3 times per day and then we have to run same code
again, and somehow the file works again. If you take a look of non
working .passwd file, it looks just like it should be. We user perl's
crypt command to crypt passwords. Any idea what's the problem, how the
generate bullet proof file locking or is there any other way to
authenticate users ?
Thanks,
Juha Vehnia
CREC, Center of Research in Electronic Commerce
------------------------------
Date: Sun, 11 Oct 1998 22:20:13 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: adding to the @INC at install time
Message-Id: <xaaU1.5$Rd3.77339@nsw.nnrp.telstra.net>
In article <6vqh05$mbk@bgtnsc02.worldnet.att.net>,
"Rathnakar Yelandur" <r.r@att.net> writes:
>>I'm looking for a solution that does not require visiting any of the
>>individual scripts and unshifting the array myself.
^^^^^^^^^^
> This should help you...
I doubt it.
> #----- PERL:: tes.pl :: Extend Perl Search Path ----
> BEGIN {
> print "PERL BEFORE INC=\n", join ("\n", @INC), "\n";
> unshift @INC, "C:\\RATH\\Perl_Lib"; # \\ is needed for Win98
^^^^^^^
The poster explicitly mentioned unshift. Implicitly that probably meant that
they didn't want to go off and edit all the scripts to put in a 'use
lib'. (BTW, Did you know about 'use lib'?)
The answer in this case most likely is, as perlfaq8 suggests, setting
the environment variable PERL5LIB. perlfaq8 does not mention your
solution, and there are reasons for that.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd. | clothes.
NSW, Australia |
------------------------------
Date: Sun, 11 Oct 1998 19:18:20 GMT
From: "Ken Bandes" <kbandes@home.com>
Subject: Re: Any List of Win32 Error Codes ?
Message-Id: <0w7U1.609$DD4.1967112@news.rdc1.nj.home.com>
I use the following script to look up error messages, which just wraps the
Win32::FormatMessage function.
To use it, give it any number of error codes (use 0x for hex codes), e.g.
msg.pl 0x80004020
Ken Bandes
----
use strict;
use Win32;
foreach (@ARGV)
{
my $errno = $_;
$errno = oct $errno if($errno =~ /^0/);
print Win32::FormatMessage $errno;
}
----
Eisen Chao wrote in message <6vg2f4$o0t$1@supernews.com>...
>
>To All:
>
>
>Any one out there know where a list of all the returned error
>codes from Win32 modules like NetResources is ? I'm getting
>some non-zero error codes but I have no idea what they mean.
>
>
>Thanks in advance,
>
>
>Eisen
------------------------------
Date: Sun, 11 Oct 1998 16:42:26 -0700
From: "Robin Bank" <rbank@csf.edu>
Subject: Any possible way to do graphics in perl??
Message-Id: <6vrcc7$9jl$5@santaclara.santafe.edu>
E-mail me your responses!
Thanks in advance...
Robin
******|
------| rbank@csf.edu
******|
------------------------------
Date: Sun, 11 Oct 1998 21:54:37 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: anyone got a rtf->html converter in perl?
Message-Id: <36222303.1493355@news.ping.be>
John Porter wrote:
>"Abandon all hope," as they say.
>RTF is a hellaciously nasty format.
>Just as "nothing can parse Perl like perl",
>nothing can parse RTF like MS Word. Use it.
Even MS Word can't do it. I have had practical experience with RTF being
generated from Word, read into Word again, and the reult was screwed up.
Then again, it's MS. Nothing like that should surprise you, if it comes
from *them*.
Bart.
------------------------------
Date: Sun, 11 Oct 1998 14:08:16 -0800
From: madame philosophe <mp@mkt2mkt.com>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <36212C48.7D518F51@mkt2mkt.com>
Re:
Date: 09 Nov 1995 02:57:30 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: system() question
> There you go; a 160-line dissertation on why questions go unanswered.
> Now don't let me hear you saying nobody ever answers your questions.
Hey thanks alot ! I found this email extremely helpful.
Perhaps I will be able to ask more intelligent questions because of it. And I'm
being sincere!
mp
------------------------------
Date: Sun, 11 Oct 1998 21:58:25 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Assigning a value to a var
Message-Id: <3624288f.62055921@nntp.ix.netcom.com>
On Sun, 11 Oct 1998 14:41:48 -0400, rjk@coos.dartmouth.edu (Ronald J
Kimball) wrote:
>Mark Priatel <mpriatel@chat.carleton.ca> wrote:
>
>> Ok, a minute after this post I took a quick look through the perl
>> manual...
>
>Next time, look through the manual first.
>
>> Is this a safe/common way to assign data?
>>
>> $name = <stdin>;
>
>STDIN should be capitalized.
>
>This is the more common way:
>
>$name = <>;
>
>because STDIN is the default filehandle for input.
And, Mark should also look through the manual (perlop, I/O Operators)
last so he can learn that
$name = <>;
does not necessarily read from STDIN.
In my code, at least, you are right that this is more common than
using <STDIN>, but the reason is most certaintly not because STDIN is
the default file handle; it's because I more often want to do what <>
does than read from STDIN.
--
Michael M Rubenstein
------------------------------
Date: Sun, 11 Oct 1998 21:54:39 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Can I FORMAT variables to be a specific length?
Message-Id: <362323d7.1705311@news.ping.be>
Guy Doucet wrote:
>I am receiving data from users. I need to format that data to a certain
>length. Is there a quick function.
Try
$_ = pack("A40", $_);
to get a 40 characters result.
Bart.
------------------------------
Date: Sun, 11 Oct 1998 14:33:31 -0500
From: Nat Guyton <nat@apart.net>
To: John.Fierke@Avnet.com
Subject: Re: Can't send mail via telnet programmatically
Message-Id: <3621080B.74414836@apart.net>
John W. Fierke wrote:
> I'm putting together some error-checking Unix scripts on a DEC-Alpha
> machine for our EDI group. Now that we have moved to MS Exchange/
> Outlook, they aren't having any luck sending mail from the Unix box.
>
> I'd like to use 'telnet [mailserver] 25', along with the proper mail
> syntax, to notify the EDI team with email messages and/or paging them via
>
> email....but it looks like I've got a problem when it comes to trying to
> send the mail commands once I've initiated the telnet!!
>
> Anybody know how to get this done? I'm writing the script in perl and
> it's fairly straight-forward :
>
> $sender="Fred.Flinstone@stone.com";
> $recipient="George.Jetson@space.com";
> open(MAIL, "| telnet dev.mail.com 25")
> || die "\nERROR - Unable to open Mail process, stopped";
> # sleep 60; # had been sleeping long enough for the server to
> # # respond
> print MAIL "mail from: $sender\n";
> print MAIL "rcpt to: $sender\n";
> print MAIL "data\n";
> print MAIL "from: $sender\n";
> print MAIL "to: $recipient\n";
> print MAIL "subject: $subject\n";
> print MAIL "$message\n";
> print MAIL ".\n";
> close(MAIL);
>
> also, all that exists is the perl binary which is 5.004_01. How much
> trouble would it be to replace that with a FULLY EQUIPPED version of perl
> (compiled with all its features)? Currently it's size is 942,080...how
> much space would I need to have? I'm just thinking that I won't be able
> to copy the Net::SMTP module and its constituants onto the box and 'use'
> them, without recompiling. OK...I just DON'T KNOW! This isn't really my
> machine to 'experiment' with.
>
> thx,
> John Fierke
>
> Anyone Without a Sense of Humor
> is at the Mercy of the Rest of Us!
> ================================================================
> | John Fierke 11333 Pagemill Road |
> | Programmer Analyst Dallas, TX 75243 |
> | Open Systems Development (V)214.553.4086 |
> | (P)214.581.1564 |
> | John.Fierke@Avnet.com (F)214.553.4004 |
> ================================================================
The Expect module should do what you want. Check CPAN...
------------------------------
Date: Sun, 11 Oct 1998 21:04:11 GMT
From: sean@mckennaprod.com (Sean McKenna)
Subject: Re: Date:::Manip, Time::Zone, - localtime() off by 1 Hour on Win98 system - Help ???
Message-Id: <36221c4e.12493260@nntp1.ba.best.com>
On 11 Oct 1998 09:50:35 GMT, "Rathnakar Yelandur" <r.r@att.net> wrote:
>I recently installed Date & Time modules for Active Perl from
>www.activestate.com/packages.
>
>Date::Manip fails with an Error - Time zone not detected. I
>got around this problem by setting TZ=EST env variable.
>Big problem is - now the System Time it reports is off by 1 Hour.
>i.e. if Time is 6:12 PM, Perl reports it as 5:12 PM.
>
>Need help...
>
>Thanks in advance
>
>Rath
>r.r@att.net
Here is how I set the TZ for Date::Manip. Change codes from Pacific
to Eastern and it should work for you as well.
@t1 = localtime(time);
$daylight_savings = $t1[8];
if ($daylight_savings) {
$main::TZ = 'PDT'
} else { $main::TZ = 'PST' }
Sean McKenna "All the world's a stage..."
------------------------------
Date: Sun, 11 Oct 1998 21:13:20 GMT
From: sean@mckennaprod.com (Sean McKenna)
Subject: Re: Date:::Manip, Time::Zone, - localtime() off by 1 Hour on Win98 system - Help ???
Message-Id: <36231f2e.13229402@nntp1.ba.best.com>
On Sun, 11 Oct 1998 21:04:11 GMT, sean@mckennaprod.com (Sean McKenna)
wrote:
>Here is how I set the TZ for Date::Manip. Change codes from Pacific
>to Eastern and it should work for you as well.
>
>@t1 = localtime(time);
>$daylight_savings = $t1[8];
>if ($daylight_savings) {
> $main::TZ = 'PDT'
>} else { $main::TZ = 'PST' }
Following up my own post, this will only work if the TZ environment
variable is left blank. From the Date::Manip documentation:
The TZ variable will override the other methods of determining the
timezone, so it should probably be left blank if any of the other
methods will work.
Otherwise, you will have to modify the variable every time you
switch to/from daylight savings time.
Sean McKenna "All the world's a stage..."
------------------------------
Date: Sun, 11 Oct 1998 17:20:49 -0500
From: Darrick Wolfe <bravo@bravodesign.com>
Subject: fading text
Message-Id: <36212F41.F2@bravodesign.com>
I'm trying to figure out how to manipulate font colors so that someone
can enter a hex color (#FF9900 for example) and it "fades" the text that
he types. for example:
fade FF9900 I want this text to fade with a slightly brighter color for
each letter and if it reaches the end of the spectrum, (FFFFFF) to start
back to the original color.
the result would be something like this:
<FONT COLOR="FF9900">I</FONT> <FONT COLOR="FF9933">w</FONT><FONT
COLOR="FF9966">a</FONT><FONT COLOR="FF9999">n</FONT> etc. etc.
It will be printed in HTML obviously from a web based cgi. My problem
is that I can not find info on manipulating the hex colors in Perl (or
in any language for that matter). This just seems to be a bit over my
head. I've looked at some methods of conversion, but it is the very
basis (if at all) to what I need:
$hexdigit = (0..9,'a'..'f')[$digit];
and
$hex2number = hex($digit);
but like I said, other than that I don't know where to begin.
If anyone out there can point me in the right direction, please please
please do so!
I would appreciate an e-mail CC, as it is difficult for me tocheck the
newsgroups on a regular basis, but I try.
Thanks in advance!!!!
Darrick
------------------------------
Date: 11 Oct 1998 12:36:42 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Help with this code
Message-Id: <ylaf32lwl1.fsf@windlord.stanford.edu>
Mark-Jason Dominus <mjd@op.net> writes:
> I've always liked this strategy better:
> while (<>) {
> s/#.*//; # Scrub comment
> next unless /\S/; # Ignore blank lines
> ...
> }
> This allows comments to occur on the same line as data, and also skips
> blank lines.
I thought about this a little, but in most of the parsers that I've
written I decided not to support comments on the same line as data because
too frequently I've wanted the parser to be able to handle *any* input
when it's in quotes and special-casing # inside quotes is just too much of
a pain.
Newlines aren't too bad if you require them to be \-escaped even in quotes:
while (<BUNDLE>) {
s/^\s+//;
next if (/^\#/ or /^$/);
s/\s+$//;
while (s/\\$//) { $_ .= "\n" . <BUNDLE>; s/\s+$// }
# ...
}
This also treats \ followed by some whitespace at the end of a line the
same as \ right at the end of the line (namely, a continuation line
escaping the newline), which is the behavior I prefer. Trailing
whitespace is too hard to see.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sun, 11 Oct 1998 21:04:23 GMT
From: sbernard@mail.esiea.fr
Subject: How to post a multipart mime format in Perl ?
Message-Id: <6vr6gn$kt6$1@nnrp1.dejanews.com>
I'd like to know how to post a mulitpart mime format using sendmail with
Perl. I'd like to send emails containing plain text and HTML. If you know how
to send HTML only, It will be useful too.
Thanks, Hijo ...
PS : please include a direct email response ;)
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 11 Oct 1998 17:04:30 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: I'm looking for someone who wants to write a complete perl-script (for free)
Message-Id: <6vr6gu$ff7$1@earth.superlink.net>
bdispa@bigfoot.com (PsIoNnEkE) writes:
>Hi !
>I'm looking for one (or a few) persons who want to write a complete
>perl-script for my new web-project. The project ain't the one you know
>from everybody, no, it's very professional.
>What I need:
>I need 2 or 3 scripts that use the same resources. It's all for the
>same purpose: voting.
[snip]
>More information and more details are available at my e-mail adres
>(bdispa@bigfoot.com)... (Dutch / English)
>Do you want to help me ? Mail me ASAP. The deadline is January 1st.
>Tnx...
You know, I really thought the quality of this sort of post would go
up in the wake of Patrick Timmins's masterful parody. Apparently
everyone's a comedian....
David Black
dblack@pilot.njin.net
------------------------------
Date: Sun, 11 Oct 1998 16:38:35 -0700
From: "Robin Bank" <rbank@csf.edu>
Subject: Is there any way to compile perl scripts?
Message-Id: <6vrcc4$9jl$3@santaclara.santafe.edu>
IF you have a response, please e-mail it to me.
Thanks in advance...
Robin
******|
------| rbank@csf.edu
******|
------------------------------
Date: Sun, 11 Oct 1998 22:29:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: mSQL and DBI Problem in PERL
Message-Id: <3jaU1.7$Rd3.77339@nsw.nnrp.telstra.net>
In article <19981009160300.28298.00015065@ng89.aol.com>,
mdevivio@aol.com (Mdevivio) writes:
>
> Can anyone tell me why this runs from the command line and not a web page?
How does it not work? You will have to be more specific. You will
also, before reposting, need to read the following documents:
http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.com/CPAN/doc/FAQs/cgi/perl-cgi-faq.html
And most of all, you should read the FAQ that comes with perl:
# perldoc perlfaq9
[The very first question is:]
My CGI script runs from the command line but not the
browser. Can you help me fix it?
Imagine that....
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd. | population.
NSW, Australia |
------------------------------
Date: Sun, 11 Oct 1998 22:52:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: NETWORK & GRAPHIC CARD INFO
Message-Id: <%EaU1.13$Rd3.77339@nsw.nnrp.telstra.net>
[Posted and Mailed]
In article <19981010181928.01520.00008841@ng104.aol.com>,
sattars@aol.com (SattarS) writes:
>
> Hi,
>
>
> Can anyone tell me how to get Network card and Graphic Card details from Perl?
> Thanks
In addition to posting this message to this newsgroup, you also
emailed it to me, and many other people that frequent this group. This
is a blatant abuse of network resources, and probably the rudest thing
I have seen in at least a year. I would strongly advise you to not do
this again.
If you choose to ignore my request, I will complain loudly to whomever
is at the other end of the line at abuse@aol.com.
Please, before even thinking of programming, get a clue or two.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: Sun, 11 Oct 1998 20:50:57 GMT
From: george@defenbaugh.com (George Defenbaugh)
Subject: Re: Newbie: using strict with filehandles
Message-Id: <36221a0b.169014061@news.net1.net>
Thank you for your help, and your comments are appreciated, but my
original question remains:
?How does one declare a file handle in advance so it passes the strict
test?
------------------------------
Date: Sun, 11 Oct 1998 21:02:08 GMT
From: "Garry T. Williams" <garry@america.net>
Subject: Re: Newbie: using strict with filehandles
Message-Id: <36211D2A.CF54EB5C@america.net>
Try:
use strict;
use FileHandle;
my $fh = new FileHandle;
open ($fh, "x") || die "can't open x, $!";
-Garry Williams
George Defenbaugh wrote:
>
> Thank you for your help, and your comments are appreciated, but my
> original question remains:
>
> ?How does one declare a file handle in advance so it passes the strict
> test?
------------------------------
Date: Sun, 11 Oct 1998 21:07:50 GMT
From: "Garry T. Williams" <garry@america.net>
Subject: Re: Newbie: using strict with filehandles
Message-Id: <36211E80.59DC4D@america.net>
Oh, I forgot to mention... Check
perldoc FileHandle
There are other useful methods in this module.
-Garry Williams
George Defenbaugh wrote:
>
> Thank you for your help, and your comments are appreciated, but my
> original question remains:
>
> ?How does one declare a file handle in advance so it passes the strict
> test?
------------------------------
Date: Sun, 11 Oct 1998 15:03:22 -0400
From: Lord chr0n0s <chr0n0s@toosexyforyou.com>
Subject: passing environment variables to sh or ksh script
Message-Id: <362100FA.657243A@toosexyforyou.com>
I know how to get environment variables in perl, using %ENV,
but, how could i, say find out what %ENV{'REMOTE_ADDR'} equals
in a bourne or korn shell script?
Thanks so much for any help!
--
Lord Chr0n0s
AkA: Nick
hismajesty@portzer0.8m.com
http://portzer0.8m.com
------------------------------
Date: 11 Oct 1998 13:26:45 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: passing environment variables to sh or ksh script
Message-Id: <ylsogukfp6.fsf@windlord.stanford.edu>
Lord chr0n0s <chr0n0s@toosexyforyou.com> writes:
> I know how to get environment variables in perl, using %ENV, but, how
> could i, say find out what %ENV{'REMOTE_ADDR'} equals in a bourne or
> korn shell script?
You really should post questions of this sort to a shell scripting
newsgroup, but environment variables in shell scripts are just regular
variables. It's $REMOTE_ADDR.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sun, 11 Oct 1998 22:24:19 GMT
From: "Sean Robertson" <seanr@zapinc.com>
Subject: performing calculations on form entries
Message-Id: <neaU1.1355$Ye1.2946952@firenze.visi.net>
I am trying to create a perl script which will take a series of variables
from a form, perform a set of calculations on them, and then return the
results. The form is part of an online store; the perl script is supposed
to take the number of items for each type of item, multiply it by the price
for that item, then return the total. One of the items has a price which
changes based on the quantity being ordered. I can get the script to
compile fine, but it isn't calculating the results. You can test it out
online at http://www.oldcash.com/order.html The cgi script is below. Any
help would be greatly appreciated.
#!/usr/bin/perl
push(@INC,"/oldcaa227/public_html/cgi-bin/");
require 'cgi-lib.pl';
# Get the input
%cgivars= &getcgivars ;
#----------------- start of &getcgivars() module ----------------------
# Read all CGI vars into an associative array.
# If multiple input fields have the same name, they are concatenated into
# one array element and delimited with the \0 character (which fails if
# the input has any \0 characters, very unlikely but conceivably
possible).
# Currently only supports Content-Type of application/x-www-form-urlencoded.
sub getcgivars {
local($in, %in) ;
local($name, $value) ;
# First, read entire string of CGI vars into $in
if ( ($ENV{'REQUEST_METHOD'} eq 'GET') ||
($ENV{'REQUEST_METHOD'} eq 'HEAD') ) {
$in= $ENV{'QUERY_STRING'} ;
} elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
if ($ENV{'CONTENT_TYPE'}=~ m#^application/x-www-form-urlencoded$#i)
{
$ENV{'CONTENT_LENGTH'}
|| &HTMLdie("No Content-Length sent with the POST request.")
;
read(STDIN, $in, $ENV{'CONTENT_LENGTH'}) ;
} else
&HTMLdie("Unsupported Content-Type: $ENV{'CONTENT_TYPE'}") ;
}
} else {
&HTMLdie("Script was called with unsupported REQUEST_METHOD.") ;
}
# Resolve and unencode name/value pairs into %in
foreach (split('&', $in)) {
s/\+/ /g ;
($name, $value)= split('=', $_, 2) ;
$name=~ s/%(..)/chr(hex($1))/ge ;
$value=~ s/%(..)/chr(hex($1))/ge ;
$in{$name}.= "\0" if defined($in{$name}) ; # concatenate multiple
vars
$in{$name}.= $value ;
}
return %in ;
}
$alert = "null";
$total_A = eval($quant_A * $price_A);
$total_B = eval($quant_B * $price_B);
$total_C = eval($quant_C * $price_C);
if($quant_S == 0){
$price = 0;
}
elsif($quant_S > 250){
$alert = "Please call 757-588-1919 for larger quantity pricing";
$quant_S = 0;
$price_S = 0;
}
elsif($quant_S > 100){
$price_S = 0.50;
}
elsif($quant_S > 25){
$price_S = 0.60;
}
elsif($quant_S > 10){
$price_S = 0.75;
}
elsif($quant_S > 0){
$price_S = 1.00;
}
else{
$alert = "Please enter a positive number";
}
$total_S = ($quant_S * $price_S);
$subtotal = ($total_A + $total_B + $total_C + $total_S);
if($subtotal == 0){
$shipping = 0;
}
elsif($subtotal > 0){
$shipping = 5.00;
}
elsif($subtotal > 15.00){
$shipping = 6.50;
}
elsif($subtotal > 40.00){
$shipping = 7.50;
}
elsif($subtotal > 100.00){
$shipping = 7.50;
}
$total = ($subtotal + $shipping);
# Print the CGI response header, required for all HTML output
# Note the extra \n, to send the blank line
print "Content-type: text/html\n\n";
print "<html>";
print "<body bgcolor='black' text='white'>";
if($alert != "null"){
print "<h1>Sorry, your order could not be processed</h1>";
print $alert;
print "Please use your browser's back button to return to the form and
check your entries.";
}
else{
print "<h1>Thank you for your order!</h1>";
print "<form action=/cgi-bin/submit.pl method=post>";
print "<h2>Large Bags</h2>";
print "<input type=\"hidden\" name=\"quant_A\" value=$quant_A>A. Capitalist
Pig Starter Kit: $quant_A x \$ $price_A each<br>\n";
print "<input type=\"hidden\" name=\"quant_B\" value=$quant_B>B. Capitalist
Pig Recovery Kit: $quant_B x \$ $price_B each<br>\n";
print "<input type=\"hidden\" name=\"quant_C\" value=$quant_C>C. My First
Million: $quant_C x \$ $price_C each<br>\n";
print "<h2>Small Bags</h2>";
print "<input type=\"hidden\" name=\"quant_S\" value=$quant_S>Small Bags:
$quant_S x \$ $price_S each<p>\n";
print "\n";
print "<input type=\"hidden\" name=\"subtotal\" value=$subtotal>Subtotal:
\$ $subtotal each<br>\n";
print "<input type=\"hidden\" name=\"shipping\" value=$shipping>Shipping \$
$shipping each<br>\n";
print "<input type=\"hidden\" name=\"total\" value=$total>Total \$ $total
each<br>\n";
print "";
}
print "</body>";
print "</html>";
------------------------------
Date: 11 Oct 1998 22:38:18 GMT
From: timothy@nmia.com (Timothy P O'Neill)
Subject: Re: Perl Robots
Message-Id: <6vrc0q$fds@hume.nmia.com>
jrrl@lycos.com wrote:
: I am working up a Perl branch of the {C,C++}Robots family.
I imagine many would be interested. Makes me think "yech", though. I've
been thinking about doing Java-robots, though. Since java runs on a
virtual machine anyway, you wouldn't have to create one for the robots,
just define the environment the robot-classes run in.
Programming languages are very much a matter of taste, though. I love Java
and hate Perl.
+---------------------------------------------------------------------+
| Timothy O'Neill Dang/Cretog8 |
+--------------+------------------------------------------------------+
| 505-843-6966 | timothy@nmia.com | http://www.nmia.com/~timothy/ |
+--------------+------------------+-----------------------------------+
| One monkey don't stop no show |
+---------------------------------------------------------------------+
------------------------------
Date: 09 Oct 1998 23:10:23 -0400
From: Walt Mankowski <waltman@netaxs.com>
Subject: Re: Please help with time...
Message-Id: <m3sogxf6xs.fsf@netaxs.com>
You might want to look at the Date::Manip module on CPAN. It's mainly
designed to work with dates, not times, but it might work with raw
times, too.
Walt
Bernie <bfb@att.net> writes:
> Thanks. I thought their might be date/time methods
> I could use.
>
>
> Martien Verbruggen wrote:
>
> > In article <361D88B9.D0DD494B@att.net>,
> > Bernie <bfb@att.net> writes:
> > > I have to add many time values together in
> > > a format like 00:01:23
> > >
> > > What's the easiest way to accomplish this?
> >
> > This is hours minutes seconds?
> >
> > One way:
> > Convert all three to seconds, add, and
> > convert back. Use split to split the three values, multiply the first
> > and second by 3600 and 60 respectively, etc.
> >
> > Another way:
> > Start by adding the last ones, use % and ? to figure out how many
> > minutes and seconds that is, carry over the minutes to the sum of all
> > the fields in the middle, etc.
> >
> > I'd probably use the first.
> >
> > Martien
> > --
> > Martien Verbruggen |
> > Webmaster www.tradingpost.com.au | The world is complex; sendmail.cf
> > Commercial Dynamics Pty. Ltd. | reflects this.
> > NSW, Australia |
> >
------------------------------
Date: Sun, 11 Oct 1998 22:34:45 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: read subdirectories
Message-Id: <9oaU1.9$Rd3.77339@nsw.nnrp.telstra.net>
In article <6vqsmp$k90$1@shadow.skypoint.net>,
Jamie Hoglund <jhoglund@mirage.skypoint.net> writes:
> I use File::Find, and like it a lot, but I might like to understand
> how to recursively read directories by hand, if nothing else just for the
> excercise.
>
> The trouble I always stumble on are symbolic links, short of ignoring
> them, it's hard to cd to the next level, and then cd back up without using
> .. (Kind of like the way midnight commander does it)
Symlinks are a traditional problem in directory recursion. I suspect
that that is exactly the reason that File::Find just ignores them, and
doesn't offer you an option to traverse them.
You could see if you can find the source to some publically available
find, maybe GNU has one, or check out the linux or freebsd ones. Most
modern versions of find will allow you to follow symlinks, and will
implement some way of sanity checking.
>From the Solaris man page for find:
# man find
[snip]
-follow Always true; causes symbolic links to be fol-
lowed. When following symbolic links, find
keeps track of the directories visited so
that it can detect infinite loops; for exam-
ple, such a loop would occur if a symbolic
link pointed to an ancestor. This expression
should not be used with the -type l expres-
sion.
[snip]
which suggests one way of dealing with it.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd. | am.
NSW, Australia |
------------------------------
Date: Sun, 11 Oct 1998 22:37:44 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: symlinks and perl
Message-Id: <YqaU1.10$Rd3.77339@nsw.nnrp.telstra.net>
In article <361E7707.57E3@jlab.org>,
Shane Dewitt <dewitt@jlab.org> writes:
> hi, this is my first time posting and i still new to perl.
>
> my problem is that i have a html form that calls a symlink in
> /usr/csite5/WebServer/httpd/cgi-bin/TestPlans/TestPlan.pl (symlink is
> called TestPlan.pl) which points to
> /usr/csite5/WebServer/httpd/cgi-bin/TestPlans/1-0/TestPlan.pl
>
> which works but the reall TestPlan.pl still thinks its in the symlink
> dir and cannot
> find it required files which are in the 1-0/. directory.
Which is exactly the behaviour you want. Imagine what would happen if
reading a symlink would cause your OS to read everything in that same
directory from the place where the linked file exists. Either symlink
all the files that you need into that directory, or symlink the whole
directory to the other place.
Alternatively, you can include
/usr/csite5/WebServer/httpd/cgi-bin/TestPlans/1-0 in your @INC, by
doing a 'use lib'.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In the fight between you and the world,
Commercial Dynamics Pty. Ltd. | back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Sun, 11 Oct 1998 16:33:33 -0700
From: "Robin Bank" <rbank@csf.edu>
Subject: Re: Syntax error
Message-Id: <6vrcc0$9jl$1@santaclara.santafe.edu>
If you want to access an individual part of an array the syntax is $var[3]
or whatever not $hold(21)
Later,
Robin
******|
------| rbank@csf.edu
******|
----------
In article <361F64B1.A2FF87EA@netwave.ca>, Imran Zalfackruddin
<imran@netwave.ca> wrote:
>Hello:
>
>I have attached a snip of a code. I am getting a syntax error on the
>assignment to the
>FORM array. What is wrong with the code??? Any help would be greatly
>appreciated.
>
>Regards.
>Imran.
>
>--------------------------------------------
>open(IN,"</var/apps/xxxx.dat");
>while(<IN>) # For each line of the file:
>{
> #
>
> #
> # SPlit the inputline into its subcomponets
> # Each line has 40 sub components
> #
>
> @hold = split(/:/,$_);
>
> if(/^#/) { next; } # Discard comments.
>
> $FORM{'sessions'} = $hold(21); <------- syntax error here
> $FORM{'expiration'} = $hold(9);
>
>......
>
>
------------------------------
Date: 11 Oct 1998 18:13:44 -0400
From: jete@dgs.dgsys.com (Jete Software Inc.)
Subject: Troubles calling Perl from C
Message-Id: <6vraio$rfa@dgs.dgsys.com>
I can no longer get the (making an external Perl script available to a Perl interpreter)
example in Orwant's perl book (pg 831-835) to compile or execute correctly.
This code use to run under 5.002, but now produces the following error messages (under
RH5.1 and perl5.00502):
What do I need to do now??
=============================================================================
#include <stdio.h>
#include <EXTERN.h>
#include <perl.h>
static void xs_init _((void));
static PerlInterpreter *my_perl;
int main(int argc, char **argv)
{
int status;
my_perl = perl_alloc();
perl_construct(my_perl);
status = perl_parse(my_perl, xs_init, argc, argv, NULL);
if (status) exit(status);
perl_call_argv("greet", G_DISCARD | G_NOARGS, argv);
perl_destruct(my_perl);
perl_free(my_perl);
exit(status);
}
static void xs_init() {}
=====================================================================================
[root@mingus /tmp]# cc -o hello hello.c -L/usr/lib/perl5/5.00502/i586-linux/CORE \
> -I/usr/lib/perl5/5.00502/i586-linux/CORE -lperl -lm
In file included from /usr/lib/perl5/5.00502/i586-linux/CORE/perl.h:1255,
from hello.c:3:
/usr/lib/perl5/5.00502/i586-linux/CORE/cop.h:216: parse error before `bool'
/usr/lib/perl5/5.00502/i586-linux/CORE/cop.h:216: warning: no semicolon at end of struct or union
/usr/lib/perl5/5.00502/i586-linux/CORE/cop.h:217: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/cop.h:226: parse error before `}'
/usr/lib/perl5/5.00502/i586-linux/CORE/cop.h:267: field `cx_subst' has incomplete type
In file included from /usr/lib/perl5/5.00502/i586-linux/CORE/perl.h:1259,
from hello.c:3:
/usr/lib/perl5/5.00502/i586-linux/CORE/scope.h:132: parse error before `bool'
/usr/lib/perl5/5.00502/i586-linux/CORE/scope.h:132: warning: no semicolon at end of struct or union
In file included from /usr/lib/perl5/5.00502/i586-linux/CORE/perl.h:2041,
from hello.c:3:
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:27: parse error before `Perl_Gv_AMupdate'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:27: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:33: parse error before `Perl_avhv_exists_ent'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:33: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:98: parse error before `Perl_do_aexec'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:98: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:101: parse error before `Perl_do_close'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:101: parse error before `bool'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:101: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:102: parse error before `Perl_do_eof'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:102: warning: data definition has no type
or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:103: parse error before `Perl_do_exec'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:103: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:115: parse error before `Perl_do_open'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:116: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:118: parse error before `Perl_do_print'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:118: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:121: parse error before `Perl_do_seek'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:121: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:149: parse error before `bool'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:182: parse error before `Perl_hv_exists'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:182: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:183: parse error before `Perl_hv_exists_ent'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:183: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:204: parse error before `Perl_io_close'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:204: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:522: parse error before `Perl_sv_2bool'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:522: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:554: parse error before `Perl_sv_derived_from'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:554: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:592: parse error before `Perl_sv_tainted'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:592: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:596: parse error before `Perl_sv_upgrade'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:596: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:600: parse error before `bool'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:603: parse error before `bool'
In file included from /usr/lib/perl5/5.00502/i586-linux/CORE/perl.h:2065,
from hello.c:3:
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:48: parse error before `PL_nomemok'
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:48: warning: data definition has no type
e or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:136: parse error before `PL_in_my'
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:136: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:144: parse error before `PL_do_undump'
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:144: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:157: parse error before `PL_collation_standard'
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:157: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:166: parse error before `PL_numeric_standard'
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:166: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:168: parse error before `PL_numeric_local'
/usr/lib/perl5/5.00502/i586-linux/CORE/perlvars.h:168: warning: data definition has no type or storage class
In file included from /usr/lib/perl5/5.00502/i586-linux/CORE/perl.h:2070,
from hello.c:3:
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:28: parse error before `PL_minus_c'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:28: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:32: parse error before `PL_preprocess'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:32: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:33: parse error before `PL_minus_n'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:33: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:34: parse error before `PL_minus_p'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:34: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:35: parse error before `PL_minus_l'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:35: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:36: parse error before `PL_minus_a'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:36: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:37: parse error before `PL_minus_F'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:37: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:38: parse error before `PL_doswitches'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:38: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:39: parse error before `PL_dowarn'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:39: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:40: parse error before `PL_doextract'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:40: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:41: parse error before `PL_sawampersand'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:41: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:42: parse error before `PL_sawstudy'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:42: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:43: parse error before `PL_sawvec'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:43: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:44: parse error before `PL_unsafe'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:44: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:120: parse error before `PL_tainting'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:120: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:152: parse error before `PL_preambled'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:152: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:192: parse error before `PL_in_clean_objs'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:192: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:193: parse error before `PL_in_clean_all'
/usr/lib/perl5/5.00502/i586-linux/CORE/intrpvar.h:193: warning: data definition has no type or storage class
In file included from /usr/lib/perl5/5.00502/i586-linux/CORE/perl.h:2072,
from hello.c:3:
/usr/lib/perl5/5.00502/i586-linux/CORE/thrdvar.h:67: parse error before `PL_tainted'
/usr/lib/perl5/5.00502/i586-linux/CORE/thrdvar.h:67: warning: data definition has no type or storage class
/usr/lib/perl5/5.00502/i586-linux/CORE/thrdvar.h:88: parse error before `PL_dirty'
/usr/lib/perl5/5.00502/i586-linux/CORE/thrdvar.h:88: warning: data definition has no type or storage class
hello.c:9: conflicting types for `main'
/usr/lib/perl5/5.00502/i586-linux/CORE/proto.h:267: previous declaration of `main'
------------------------------
Date: Sun, 11 Oct 1998 16:37:44 -0700
From: "Robin Bank" <rbank@csf.edu>
Subject: Re: Whole Random number?
Message-Id: <6vrcc2$9jl$2@santaclara.santafe.edu>
The best way to do this is
$var = int(rand(10) ) + 1;
print "$var\n";
The "int" takes off all of the decimals.
The "+ 1" makes it so your first integer is one instead of 0, making it
easier to work with.
Hope that helps...
Later,
Robin
******|
------| rbank@csf.edu
******|
------------------------------
Date: 11 Oct 1998 12:43:22 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Why it doesn't work under UNIX??????
Message-Id: <yl7ly6lw9x.fsf@windlord.stanford.edu>
I R A Aggie <fl_aggie@thepentagon.com> writes:
> Your first interpretation is incorrect, while your second thought
> touches upon the correct answer:
> <*.txt> is a typeglob.
Um, no, it's just a glob. Very different things.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3948
**************************************