Wed, 9 Feb 2011 22:44:10 -0800 (PST) письмо от "C.DeRykus" :
> On Feb 9, 10:07 pm, terry.p...@mail.ru (terry peng) wrote:
> > hello,
> >
> > when in the case "return undef" I prefer just "return" coz in list context
> it will return an empty list.
> >
> > my $exist = ...
> > if ($exist) {
> >
On Feb 9, 10:07 pm, terry.p...@mail.ru (terry peng) wrote:
> hello,
>
> when in the case "return undef" I prefer just "return" coz in list context it
> will return an empty list.
>
> my $exist = ...
> if ($exist) {
> return 1;
>
> } else {
> return;
> }
>
> the code above can work, but hav
> "PK" == Parag Kalra writes:
PK> Is this what you mean
PK> ($exist) ? return 1 : return undef
PK> I think even this should work
PK> ($exist) ? 1 : 0;
he wants an empty list in a list context when returning the false value
so neither of those works.
uri
--
Uri Guttman -- u
>
> return 1 if $exists ;
> return ;
>
> then it is easy to see what conditions will return what values. no need
> for if/else blocks or noisy ?: ops.
>
That's a good solution.
Thanks much. :)
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginner
> "tp" == terry peng writes:
tp> when in the case "return undef" I prefer just "return" coz in list
tp> context it will return an empty list.
tp> my $exist = ...
tp> if ($exist) {
tp> return 1;
tp> } else {
tp> return;
tp> }
tp> the code above can work, but having
Is this what you mean
($exist) ? return 1 : return undef
I think even this should work
($exist) ? 1 : 0;
~Parag
2011/2/9 terry peng
>
> hello,
>
> when in the case "return undef" I prefer just "return" coz in list context
> it will return an empty list.
>
> my $exist = ...
> if ($exist) {
hello,
when in the case "return undef" I prefer just "return" coz in list context it
will return an empty list.
my $exist = ...
if ($exist) {
return 1;
} else {
return;
}
the code above can work, but having many lines.
So I want:
return $exist ? 1 : (...);
what should be put in (...)
gry wrote:
[[v5.8.8 built for x86_64-linux-thread-multi]
#!/usr/bin/perl -W
use Getopt::Long;
my $dml = 0;
my $iterations = 10;
my %options = ("dml!" => \$dml,
"iterations=i" => \$iterations);
GetOptions(%options) || die "bad options";
printf "dml=$dml\n";
That should be eithe
Hello:
I have some static data I want to wrap in a Data.pm, what is the best
way of doing this.
package data;
use strict;
use warnings;
my $data=1;
1;
I tried
use data;
print $data; but it doesn't work, also I tried print data::$data and
still doesn't work.
Thanks for helping!
Jim
--
To unsu
On 11-02-09 04:52 PM, gry wrote:
[[v5.8.8 built for x86_64-linux-thread-multi]
#!/usr/bin/perl -W
use Getopt::Long;
my $dml = 0;
my $iterations = 10;
my %options = ("dml!" => \$dml,
"iterations=i" => \$iterations);
GetOptions(%options) || die "bad options";
printf "dml=$dml\n";
On Wed, Feb 09, 2011 at 10:52:24PM +, Rob Dixon wrote:
> On 09/02/2011 17:05, Paul Johnson wrote:
> >
> >Of course you can redefine the problem this way, but it's more interesting to
> >solve the original problem.
> >
> >To go with Rob's solution, here's something that's (more) correct:
> Hey
[[v5.8.8 built for x86_64-linux-thread-multi]
#!/usr/bin/perl -W
use Getopt::Long;
my $dml = 0;
my $iterations = 10;
my %options = ("dml!" => \$dml,
"iterations=i" => \$iterations);
GetOptions(%options) || die "bad options";
printf "dml=$dml\n";
print %options;
foreach $key (sort ke
- Original Message -
From: "Jim Gibson"
To: "Perl List"
Sent: Wednesday, February 09, 2011 6:15 PM
Subject: Re: Randomizing a 24hr time period
On 2/9/11 Wed Feb 9, 2011 2:30 PM, "Mike Blezien"
scribbled:
- Original Message -
From: "Jim Gibson"
To: "Perl List"
Sent: Wed
On 2/9/11 Wed Feb 9, 2011 2:30 PM, "Mike Blezien"
scribbled:
> - Original Message -
> From: "Jim Gibson"
> To: "Perl List"
> Sent: Wednesday, February 09, 2011 4:04 PM
> Subject: Re: Randomizing a 24hr time period
>
>
>> On 2/9/11 Wed Feb 9, 2011 1:05 PM, "Mike Blezien"
>> scribb
On 09/02/2011 17:05, Paul Johnson wrote:
Of course you can redefine the problem this way, but it's more interesting to
solve the original problem.
To go with Rob's solution, here's something that's (more) correct:
#!/usr/bin/perl
use strict; use warnings;
my ($messages, $time_period) = @ARG
- Original Message -
From: "Jim Gibson"
To: "Perl List"
Sent: Wednesday, February 09, 2011 4:04 PM
Subject: Re: Randomizing a 24hr time period
On 2/9/11 Wed Feb 9, 2011 1:05 PM, "Mike Blezien"
scribbled:
- Original Message -
From: "Paul Johnson"
To: "Uri Guttman"
Cc: "
On 2/9/11 Wed Feb 9, 2011 1:05 PM, "Mike Blezien"
scribbled:
> - Original Message -
> From: "Paul Johnson"
> To: "Uri Guttman"
> Cc: "Mike Blezien" ; "Perl List"
> Sent: Wednesday, February 09, 2011 11:05 AM
> Subject: Re: Randomizing a 24hr time period
>
>
>> On Wed, Feb 09, 2011
- Original Message -
From: "Paul Johnson"
To: "Uri Guttman"
Cc: "Mike Blezien" ; "Perl List"
Sent: Wednesday, February 09, 2011 11:05 AM
Subject: Re: Randomizing a 24hr time period
On Wed, Feb 09, 2011 at 11:16:07AM -0500, Uri Guttman wrote:
> "MB" == Mike Blezien writes:
>
I am trying to write a script that takes the extend name as an arg and retrieves
the output for further processing.
I am not sure how to do this, get_request() needs a numeric oid, is there a
way around this or is get_request() not the best way to do this?
Thanks for any help,
jlc
--
To unsubscr
- Original Message -
From: "Paul Johnson"
To: "Uri Guttman"
Cc: "Mike Blezien" ; "Perl List"
Sent: Wednesday, February 09, 2011 11:05 AM
Subject: Re: Randomizing a 24hr time period
On Wed, Feb 09, 2011 at 11:16:07AM -0500, Uri Guttman wrote:
> "MB" == Mike Blezien writes:
>
On Wed, Feb 09, 2011 at 11:16:07AM -0500, Uri Guttman wrote:
> > "MB" == Mike Blezien writes:
>
> >> as i said a simple solution is to slice up the 24 hours into fixed
> >> intervals. then pick a random time INSIDE each interval. random enough
> >> for those types of people. this is clo
On Wed, Feb 9, 2011 at 9:41 AM, Rob Dixon wrote:
> On 07/02/2011 21:30, Mike Blezien wrote:
>
>> I'm trying to come up with a function to send out X number of message per
>> day(24hr day) but we need to randomize the time factore each day. For
>> example if
>> 50 messages are scheduled to be sent
> "MB" == Mike Blezien writes:
>> as i said a simple solution is to slice up the 24 hours into fixed
>> intervals. then pick a random time INSIDE each interval. random enough
>> for those types of people. this is close to one message an hour so there
>> is plenty of variability within
New to this mailing list so this is my first response.
Why not just take (24*60)/[number of unsent messages] and send them on
that interval?
You probably dont want messages appearing in the dead of night, so you
can safely assume the last 2 hours and first 6 are off limits by doing
((16*60)/[numb
- Original Message -
From: "Uri Guttman"
To: "Mike Blezien"
Cc: "Perl List" ; "Mike McClain"
Sent: Wednesday, February 09, 2011 9:35 AM
Subject: Re: Randomizing a 24hr time period
"MB" == Mike Blezien writes:
MB> What they have right now are about 25 messages they wish to spread
On 07/02/2011 21:30, Mike Blezien wrote:
Hello,
I'm trying to come up with a function to send out X number of message per
day(24hr day) but we need to randomize the time factore each day. For example if
50 messages are scheduled to be sent out in 24 hr time period we want to
randomize the times
> "MB" == Mike Blezien writes:
MB> What they have right now are about 25 messages they wish to spread
MB> out through out a 24hr period so they are sent out randomly during
MB> this 24 period, not a pre determined every X minutes or X
MB> hours. Why I'm not really sure, but that'
Just adding a little to this discussion then. :-)
Threads regardless of the language are meant to do multiple things in
parallel. For instance I'm at the moment working on a tool that extracts
vast amounts of data from a web service as the calls to that service are
pretty much independent and the
On Tuesday 08 Feb 2011 10:05:47 Dr.Ruud wrote:
> On 2011-02-07 11:30, Shlomi Fish wrote:
> > Threads work pretty well in C, though they are extremely tricky to get
> > right for non-trivial programs
>
> That they work "pretty well" is probably about user experience of some
> heavily interactive sy
What they have right now are about 25 messages they wish to spread out through
out a 24hr period so they are sent out randomly during this 24 period, not a
pre determined every X minutes or X hours. Why I'm not really sure, but
that's what they want to do. I think I have it figured out thou
> "MB" == Mike Blezien writes:
MB> Uri,
MB> yes that does make sense but that's what the customer wants :)
MB> There always right aren't they !!
then do something very simple. send a message every N minutes where N is
randomly picked from say 5-10. they will never know it wasn't a mor
Uri,
yes that does make sense but that's what the customer wants :) There always
right aren't they !!
Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Original Message -
Fr
> "MB" == Mike Blezien writes:
MB> it isn't for spam I assure you. A client of ours sends out 25-50,
MB> messages/quotes, a day to various spiritual web sites. And they
MB> have already been approved by the web sites they are posted
MB> too. They just wanted a solution to randomize wh
it isn't for spam I assure you. A client of ours sends out 25-50,
messages/quotes, a day to various spiritual web sites. And they have already
been approved by the web sites they are posted too. They just wanted a solution
to randomize when the messages go out so they are like a "surprize" when
On 2011-02-07 07:44, Octavian Rasnita wrote:
From: "Dr.Ruud"
On 2011-02-06 12:12, terry peng wrote:
What's the suggested module for perl's threads?
I have been using Perl 5.12 under linux.
Stay away from threads. Design and develop in a way that no internal
resources (but read-only data) a
On 2011-02-07 11:30, Shlomi Fish wrote:
Threads work pretty well in C, though they are extremely tricky to get right
for non-trivial programs
That they work "pretty well" is probably about user experience of some
heavily interactive system. But only if the user accepts crashes and
deadlocks
On Mon, Feb 07, 2011 at 03:30:03PM -0600, Mike Blezien wrote:
> I'm trying to come up with a function to send out X number of message per
> day(24hr day) but we need to randomize the time factore each day. For
> Hope this makes sense, and someone may have done this before or may have
> some in
37 matches
Mail list logo