> I am creating interesting (for me that is) applications at this site.
> But I would like to be able to generate a Graph somehow.
> Does anyone have any general idea how this might be possible?
Hello,
I once read part of the book "Graphics Programming with Perl" which is also
suitable for you I t
>> @tmp = map { (split)[2] } grep { /localhost/ } ;
>
>This is a bad idea if the file you are reading from is at all large.
Yes memory consuming of using map and grep is the fact.
But AFAIK postgresql.conf is not big at all (just a few lines) b/c I'm pretty
familiar with it. :)
--
To unsubscr
On 3/16/07, Jeff Pang <[EMAIL PROTECTED]> wrote:
snip
@tmp = map { (split)[2] } grep { /localhost/ } ;
snip
This is a bad idea if the file you are reading from is at all large.
It is better to use a real loop rather than map or grep when reading
from a file. The problem lies in the fact that
Another way,
my @c = (1,2,3); my @d = (1,2);
print join '',$c[int rand @c],$d[int rand @d];
This could generate arbitrary random string other than the numbers of "1 2 3"
or "1 2".
ie,the original contents could be:
my @c = qw(a,b,c);
my @d = qw(4,5,6);
>
>Hello, I need to generate two random
On 3/16/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
> my $num = int rand 3 + 1;
That will return either 0, 1, 2 or 3. The addition has higher precedence.
snip
Yeah, I saw that after I posted. That is what I get for posting untested code.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
Fo
On 3/16/07, Chas Owens <[EMAIL PROTECTED]> wrote:
snip
If you need a better pseudo-random number than rand can provide and
you are using Linux (or possibly other unix like operating systems)
you can read from /dev/urandom
snip
I should have hit CPAN first. The Crypt::Random* module provides a
>In shell-script I get a variable with command line:
>
>AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
> | awk '{print $3}' | head -n1`
>
Hello,
In Perl it can most likely be written as:
open FILE,"$INPUTDB/postgresql.conf" or die $!;
@tmp = map { (split)[2] } grep { /localhost/ } ;
c
Chas Owens wrote:
> On 3/16/07, Grant <[EMAIL PROTECTED]> wrote:
>> Hello, I need to generate two random numbers. One should be a 1, 2,
>> or 3, and the other should be a 1 or 2. How can I do that?
>
> That depends on your needs. The rand function creates decent quality
> pseudo-random numbers
On 3/16/07, Chas Owens <[EMAIL PROTECTED]> wrote:
snip
my $num = int rand 3 + 1;
snip
oops, that should be
my $num = int rand(3) + 1;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 3/16/07, Grant <[EMAIL PROTECTED]> wrote:
Hello, I need to generate two random numbers. One should be a 1, 2,
or 3, and the other should be a 1 or 2. How can I do that?
- Grant
That depends on your needs. The rand function creates decent quality
pseudo-random numbers (it calls srand with
Grant wrote:
> Hello,
Hello,
> I need to generate two random numbers. One should be a 1, 2,
> or 3,
int( rand 3 ) + 1
> and the other should be a 1 or 2.
int( rand 2 ) + 1
perldoc -f int
perldoc -f rand
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
Hello, I need to generate two random numbers. One should be a 1, 2,
or 3, and the other should be a 1 or 2. How can I do that?
- Grant
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 3/15/07, Grant <[EMAIL PROTECTED]> wrote:
> > Does anyone know of a perl module for pulling the actual search
> > queries from search engine URLs?
Have you looked on CPAN yet? I found this, but there may be something better:
http://search.cpan.org/~sden/URI-ParseSearchString-1.9/lib/UR
Rodrigo Faria Tavares wrote:
> Hello,
Hello,
> In shell-script I get a variable with command line:
>
> AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
> | awk '{print $3}' | head -n1`
UUOC:
AUXIP=`grep "localhost" "$INPUTDB/postgresql.conf" | awk '{print $3}' | head
-n1`
AWK can do re
Hello,
In shell-script I get a variable with command line:
AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
| awk '{print $3}' | head -n1`
In C++, I use the functions read, write and others for
manipulation files.
And Pearl ?
After I open the file, i like to get a simple word and
store
On 3/16/07, Rodrigo Faria Tavares <[EMAIL PROTECTED]> wrote:
snip
After I open the file, i like to get a simple word and
store in a scalar variable. Or write after line 10 for
example. And others.
snip
In Perl file operations are generally handled by file handles. If you
want to use the object
On 3/16/07, Alan <[EMAIL PROTECTED]> wrote:
I wrote:
> (ftp), however, does not work which I'd guess is due to difference in
> communication method.
Doh! (Net::FTP struck me upside the head!).
Don't reinvent the wheel. LWP comes with the lwp-download and
lwp-request scripts. They're normally
> > > Does anyone know of a perl module for pulling the actual search
> > > queries from search engine URLs?
Have you looked on CPAN yet? I found this, but there may be something better:
http://search.cpan.org/~sden/URI-ParseSearchString-1.9/lib/URI/ParseSearchString.pm
Oh man that looks
Hi Rodrigo,
On 2007/03/16, at 18:09, Rodrigo Faria Tavares wrote:
Hello,
In shell-script I get a variable with command line:
AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
| awk '{print $3}' | head -n1`
In C++, I use the functions read, write and others for
manipulation files.
And P
On 2007/03/16, at 20:33, Ana Saiz García wrote:
Thank you for your answer
On 15/03/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 3/15/07, Ana Saiz García <[EMAIL PROTECTED]> wrote:
> Hello everybody
>
> I have to make a little program that deals with the contents of
some
> ar archives. Do yo
Hello,
In shell-script I get a variable with command line:
AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
| awk '{print $3}' | head -n1`
In C++, I use the functions read, write and others for
manipulation files.
And Pearl ?
After I open the file, i like to get a simple word and
store
Thank you for your answer
On 15/03/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 3/15/07, Ana Saiz García <[EMAIL PROTECTED]> wrote:
> Hello everybody
>
> I have to make a little program that deals with the contents of some
> ar archives. Do you know any alternative way to do this without using
>
Alan wrote:
Hi.
The orig post of this code did not come to my email -- but the post is on
Google Groups. (I'm emailing).
I got the code (as enclosed below) working when the url is http. But,
ftp://slackware.mirrors.tds.net/pub/slackware/slackware-11.0-iso
(ftp), however, does not work whi
23 matches
Mail list logo