Dan wrote:
>
> how is it possible to get a random number between x and y? in know
> int(rand(10)) returns an integer between 0 and 9, but how do i get it so
> that i can get a random integer say between 5 and 10 inclusive?
You want a random integer from the set ( 5, 6, 7, 8, 9, 10 ). Subtract
5
--On Saturday, September 20, 2003 20:58 +0100 dan
<[EMAIL PROTECTED]> wrote:
how is it possible to get a random number between x and y? in know
int(rand(10)) returns an integer between 0 and 9, but how do i get
it so that i can get a random integer say between 5 and 10
inclusive?
How about:
$num
sub rand_range {
my ($x, $y) = @_;
return int(rand($y - $x)) + $x;
}
On Saturday, September 20, 2003, at 03:58 PM, dan wrote:
how is it possible to get a random number between x and y? in know
int(rand(10)) returns an integer between 0 and 9, but how do i get it
so
that i can get
This should work ...
#!/usr/bin/perl -w
my $num = int (rand(10) +1);
if ($num >= 5 and $num <= 10) {
print "$num\n";
}
else {
print "Sorry ... \n";
}
Hope that helps ...
Adam
On Saturday 20 September 2003 12:58 pm, dan wrote:
: how is it possible to get a random number between x
how is it possible to get a random number between x and y? in know
int(rand(10)) returns an integer between 0 and 9, but how do i get it so
that i can get a random integer say between 5 and 10 inclusive?
many thanks
dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-m
Dan Anderson wrote:
How would I go about creating a perl script to act as a mail client? Is
there a good module for this?
More specifically, I am trying to create a perl script to monitor the
inbox of the email address from a paypal account, and when an e-mail
confirming the payment of a user who
How would I go about creating a perl script to act as a mail client? Is
there a good module for this?
More specifically, I am trying to create a perl script to monitor the
inbox of the email address from a paypal account, and when an e-mail
confirming the payment of a user who signed up, activate
Jerry Rocteur wrote:
Hi,
How do you guys always know what perldoc option to give to find info..
John knows them all backwards but Is there some kind of index or is it
just experience and if it is experience then it is useless to those
learning... ??
Sometimes I spend ages and still
Hi,
How do you guys always know what perldoc option to give to find info..
John knows them all backwards but Is there some kind of index or is it
just experience and if it is experience then it is useless to those
learning... ??
Sometimes I spend ages and still can't find what I'm
Eric Rose wrote:
Are these part of CPAN modules or built into Perl itself? I'm trying to
install Mysql and it's complaining that perl(this) and perl(the) are
missing. I couldn't find anything on Google.
Do you mean 'this' and 'the' explicitly or are you using them as
placeholders for more specif
Todd W. wrote:
RTFM for the HandleError property of DBI objects:
http://search.cpan.org/author/TIMB/DBI-1.38/DBI.pm#DBI_Utility_Functions
Scroll down to $h->{HandleError}...
You can set it to a code ref that is called when a DBI exception is thrown.
Read the docs very carefully, you can desig
Rajesh Dorairajan wrote:
Does anyone know where I can find a good implementation of OpenSSL library
on Perl. I tried Massimmilio Pala's OpenCA::OpenSSL and ran into some issues
there. Specifically, I am not able to generate a request. Whatever DN string
I pass does not seem to be acceptable to the
Perl wrote:
I would like to have a display name present in the FROM field of
messages I send.
Example: Reporting Agent < [EMAIL PROTECTED] >
All the documentation I see involves an SMTP address only.
Is there an easy way to do this?
Though I am not 100% sure I am pretty certain that MIME::Lite
Ben Perry wrote:
Is there a way to define a line separator because i have a file with many lines but the actual newlines are scattered and i would like double space to represent a new line in this file, Can someone offer me some advise please.
This is the special variable $/ check out:
perldoc pe
Is there a way to define a line separator because i have a file with many lines but
the actual newlines are scattered and i would like double space to represent a new
line in this file, Can someone offer me some advise please.
<[EMAIL PROTECTED]> wrote:
>
> I'm having trouble grasping the syntax to perform foreach operation on an
> anonymous array within an anonymous hash reference.
>
> my $hashRef = { bah => "humbug",
>list => [ "lions", "tigers", "bears", "oh_my" ],
>woo => "hoo" };
>
> How can I run a foreach
Hello,
I'm having trouble grasping the syntax to perform foreach operation on an
anonymous array within an anonymous hash reference.
my $hashRef = { bah => "humbug",
list => [ "lions", "tigers", "bears", "oh_my" ],
woo => "hoo" };
How can I run a foreach on every item in that anonymous ar
On Sat, Sep 20, 2003 at 03:56:14PM +0530 Ramprasad A Padmanabhan wrote:
>I have a script in which I am using foreach in two diff ways
> I am doing a last; in the very first loop So each time the variable $t
> should be assigned only once.
>
> But you can see the results dont match.
>
>
> #
From: Anonymous <[EMAIL PROTECTED]>
You are aware that the domain nospam.com is registered, aren't you? If
you really don't want to give any email address, use example.com as
domain (or any other, that truely doesn't exist).
On Fri, Sep 19, 2003 at 09:08:13PM -0400 Anonymous wrote:
> How do I get
Anonymous wrote:
>
> How do I get perl to chose a random number from a range (1-13) and
> export it to a numeric variable? Any help would be appreciated.
I assume you mean integers?
$value = int rand(13) + 1;
BTW It would be nice to give a name, rather than posting as
'Anonymous'.
Rob
--
Hello all,
I have a script in which I am using foreach in two diff ways
I am doing a last; in the very first loop So each time the variable $t
should be assigned only once.
But you can see the results dont match.
#!/usr/bin/perl
use strict;
use warnings;
my @alpha = qw(a b c d );
my $t="";
fo
How do I get perl to chose a random number from a range (1-13) and
export it to a numeric variable? Any help would be appreciated.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Todd W. wrote:
"Paul Kraus" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Am I able to write a network app say on one of my Linux servers? Then
provide a gui that would run on the w32 workstations? Do I have to
install perl / tk on all of the workstations to do this?
Sure yo
Paul Kraus wrote:
I saw someone mention that tk was the better route to go for a UI then a
web interface. I have several office applications that I have written
that I was going to write html interfaces for. I would love to avoid
having to learn web development to :) Can anyone give me a break dow
24 matches
Mail list logo