AW: AW: How do I pick one random element from an array?

2009-11-02 Thread Thomas Bätzler
Dave Tang asked: > Just a quick question, how does Perl interpret something like > $array[0.7995038473872]? Just like $array[ int(0.7995038473872) ], i.e. the floating point number is coerced into an integer value by cutting off the decimal places. HTH, Thomas -- To unsubscribe, e-mail: beginn

Re: AW: How do I pick one random element from an array?

2009-11-02 Thread Dave Tang
On Tue, 03 Nov 2009 17:23:38 +1000, Thomas Bätzler wrote: Majian asked: [...] print "Array of random: $array[rand @array]\n"; I thoght it might work but it doesnt. I hope someone could give me an idea to work this out... TIMTOWTDY: a) print "Array of random: $array[rand( @array ) ] \n

AW: How do I pick one random element from an array?

2009-11-02 Thread Thomas Bätzler
Majian asked: [...] > print "Array of random: $array[rand @array]\n"; > > > I thoght it might work but it doesnt. I hope someone could give me an > idea to work this out... TIMTOWTDY: a) print "Array of random: $array[rand( @array ) ] \n"; b) print "Array of random: " . $array[rand @array] .

How do I pick one random element from an array?

2009-11-02 Thread Majian
Hi ,all : I want to know if there is a way in which I can randomnize(?) the content in an array. In this example : my @array = ('uriel', 'daniel', 'joel', 'samuel'); Now what I want is create a process so every time I print the array it prints one element from the array . I wrote it like this

Re: Problem about substitution..

2009-11-02 Thread John W. Krahn
Remy Guo wrote: hi folks, Hello, i've got problem when trying to perform a substitution. the text file i want to process is like this: ... XX { ABDADADGA afj*DHFHH } (a123) XXDFAAF { af2hwefh fauufui } (b332) ... i want to match the content in the parenthesis (a123 and b332, here) an

RE: the google keywords for debug...

2009-11-02 Thread Hack, Gabi (ext)
hi bruce, warn throws a warning message on STDERR. see perldoc -f warn warn LIST Produces a message on STDERR just like "die", but doesn't exit or throw an excep- tion. If LIST is empty and $@ already contains a value (typically from a previ

Re: Problem about substitution..

2009-11-02 Thread Remy Guo
oops...sorry, the subitution line should be $_ =~ s/\(.*\)/$i;$j/ but it doesn't work... 2009/11/3 Remy Guo > hi folks, > i've got problem when trying to perform a substitution. > > the text file i want to process is like this: > ... > XX { > ABDADADGA > afj*DHFHH > } (a123) > XXDFAAF { >

Re: Learning Perl Student Workbook

2009-11-02 Thread Telemachus
On Mon Nov 02 2009 @ 7:14, tom smith wrote: > use strict; > use warnings; > > $\ = "\n"; > > my @book_types = ('hard cover book', 'soft cover book', 'ebook'); > > if ('soft cover book' eq 'ebook') { > print 'yes'; > } else { > print 'no'; > } > > --output:-- > no Right. The original po

Problem about substitution..

2009-11-02 Thread Remy Guo
hi folks, i've got problem when trying to perform a substitution. the text file i want to process is like this: ... XX { ABDADADGA afj*DHFHH } (a123) XXDFAAF { af2hwefh fauufui } (b332) ... i want to match the content in the parenthesis (a123 and b332, here) and replace them with a sorted

Re: Learning Perl Student Workbook

2009-11-02 Thread tom smith
On Mon, Nov 2, 2009 at 10:36 AM, Telemachus wrote: > On Mon Nov 02 2009 @ 9:33, Parag Kalra wrote: > > Hey Folks, > > > > This thread was about book - 'Learning Perl Student Workbook' and not the > > book - 'Learning Perl' > > > > So is there a way we can buy genuine/official/legal ebook version

Re: Move to more recent gcc version.. what to expect

2009-11-02 Thread Harry Putnam
Jeremiah Foster writes: [...] > Harry, this appears to be off topic since it does not deal directly > with beginner's perl questions. I think you may find better response > on a Gentoo list. Off topic and embarrassing. My 2nd time in the spc of a week. I've got to quit jumping to perl when I

Re: tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread Jeremiah Foster
On Nov 2, 2009, at 20:38, tom smith wrote: On Mon, Nov 2, 2009 at 8:02 AM, Peter Scott wrote: On Mon, 02 Nov 2009 04:25:18 -0700, Tom Smith wrote: I believe that your HTML::Parser needs upgrading. But you're getting the system one, which is often dangerous to touch. I think you should

Re: Move to more recent gcc version.. what to expect

2009-11-02 Thread Jeremiah Foster
On Nov 2, 2009, at 17:07, Harry Putnam wrote: I noticed I've been masking gcc beyond version 4.3.2-r3, and have forgotten why I had it masked. I'm updating world right now, and wondered if I were to move up to most recent gcc (4.4.2), which would be a 5 version jump, what I could expect in the

Re: the google keywords for debug...

2009-11-02 Thread Ming Qian
Thank you Shawn again. Bruce. On Mon, Nov 2, 2009 at 3:48 PM, Ming Qian wrote: > Thanks a lot. > > Oh Well! > I understand the problem. > After I added the pint or warn message, I didn't restart Apache. > If I restart the Apache, it will print all the message to the project > private logs. > >

Re: suggestion for FAQ

2009-11-02 Thread tom smith
On Mon, Nov 2, 2009 at 12:35 PM, Paul Johnson wrote: > On Mon, Nov 02, 2009 at 10:59:09AM -0500, Uri Guttman wrote: > > > "ts" == tom smith writes: > > > > ts> Hi, > > ts> Nowhere in the FAQ does it list the address to which you can send > your > > ts> beginning programming questions.

Re: the google keywords for debug...

2009-11-02 Thread Ming Qian
Thank you Shawn! The CGI::Carp seems works. And, I added such code: open(MYTMP, ">> /mytmp.log"); print MYTMP "test.\n"; close(MYTMP); It seems works. But, I am still confused the project's warn message. If I add a simple warn code in the same place, such as: warn "simple warn message\n"; I c

Re: Regex to array woes

2009-11-02 Thread tom smith
On Mon, Nov 2, 2009 at 7:54 AM, Brent Clark wrote: > Hiya > > I was hoping that someone would be kind to help me. > > I have a string like so : > > Haresources : 10.203.4.5, Interfaces : 10.203.4.5 10.203.4.7 > > Im trying to get the ip's after Interfaces into an array, but for the likes > of me,

Re: tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread tom smith
On Mon, Nov 2, 2009 at 8:02 AM, Peter Scott wrote: > On Mon, 02 Nov 2009 04:25:18 -0700, Tom Smith wrote: > > base/message-charset.t 1/21 Can't locate > > auto/HTML/Parser/utf8_mode.alin @INC (@INC contains: ../blib/lib > > ../blib/arch ../. > > /System/Library/Perl/5.8.6/darwin-thread-multi

Re: suggestion for FAQ

2009-11-02 Thread Paul Johnson
On Mon, Nov 02, 2009 at 10:59:09AM -0500, Uri Guttman wrote: > > "ts" == tom smith writes: > > ts> Hi, > ts> Nowhere in the FAQ does it list the address to which you can send your > ts> beginning programming questions. The FAQ lists the address for > subscribing: > > ts> beginners-

Re: POE with IO::Socket

2009-11-02 Thread Brian J. Miller
Someone Something wrote: How about threading? How hard is it? Where can I find a good tutorial? See "Starting Points" on the home page here: http://poe.perl.org/ Also note there is a mailing list specifically for POE related questions where you may get more help. -- Brian J. Miller End Po

Re: Learning Perl Student Workbook

2009-11-02 Thread Telemachus
On Mon Nov 02 2009 @ 9:33, Parag Kalra wrote: > Hey Folks, > > This thread was about book - 'Learning Perl Student Workbook' and not the > book - 'Learning Perl' > > So is there a way we can buy genuine/official/legal ebook version of > 'Learning Perl Student Workbook' from somewhere. > > If ye

Re: Regex to array woes

2009-11-02 Thread Dermot
2009/11/2 Brent Clark : > Hiya > > I was hoping that someone would be kind to help me. > > I have a string like so : > > Haresources : 10.203.4.5, Interfaces : 10.203.4.5 10.203.4.7 > > Im trying to get the ip's after Interfaces into an array, but for the likes > of me, im just not getting it right

Query on Threads, receiving Segment Fault.

2009-11-02 Thread Prasad Joshi
Hi All, I want to run multiple commands on a remote machine simultaneously. What I did is created a thread for each command, created an ssh object for each command and passed it to a function which simply runs command on remote machine using SSH. Here is the part of the code

Move to more recent gcc version.. what to expect

2009-11-02 Thread Harry Putnam
I noticed I've been masking gcc beyond version 4.3.2-r3, and have forgotten why I had it masked. I'm updating world right now, and wondered if I were to move up to most recent gcc (4.4.2), which would be a 5 version jump, what I could expect in the way of problems. Would I need to re-emerge just

Re: Learning Perl Student Workbook

2009-11-02 Thread Parag Kalra
Hey Folks, This thread was about book - 'Learning Perl Student Workbook' and not the book - 'Learning Perl' So is there a way we can buy genuine/official/legal ebook version of 'Learning Perl Student Workbook' from somewhere. If yes then please redirect us to the same. Cheers, Parag On Mon,

Re: suggestion for FAQ

2009-11-02 Thread Uri Guttman
> "ts" == tom smith writes: ts> Hi, ts> Nowhere in the FAQ does it list the address to which you can send your ts> beginning programming questions. The FAQ lists the address for subscribing: ts> beginners-subscr...@perl.org ts> But the FAQ doesn't list the email address to which

Re: the google keywords for debug...

2009-11-02 Thread Shawn H Corey
Ming Qian wrote: > Sorry. This is the complete email. > > Dear All, > > I am a beginner. > Recently, I receive a project in perl. > In some *.pm files, > > use Carp; > . > > sub A { > . > warn "a warn message"; > .. > } > > I am sure that sub A

Re: the google keywords for debug...

2009-11-02 Thread Ming Qian
Sorry. This is the complete email. Dear All, I am a beginner. Recently, I receive a project in perl. In some *.pm files, use Carp; . sub A { . warn "a warn message"; .. } I am sure that sub A was executed. But I can not find the warn message in

Re: tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread Peter Scott
On Mon, 02 Nov 2009 04:25:18 -0700, Tom Smith wrote: > base/message-charset.t 1/21 Can't locate > auto/HTML/Parser/utf8_mode.alin @INC (@INC contains: ../blib/lib > ../blib/arch ../. > /System/Library/Perl/5.8.6/darwin-thread-multi-2level > /System/Library/Perl/5.8.6 > /Library/Perl/5.8.6/darw

Regex to array woes

2009-11-02 Thread Brent Clark
Hiya I was hoping that someone would be kind to help me. I have a string like so : Haresources : 10.203.4.5, Interfaces : 10.203.4.5 10.203.4.7 Im trying to get the ip's after Interfaces into an array, but for the likes of me, im just not getting it right. This is what I currently got. my @

the google keywords for debug...

2009-11-02 Thread Ming Qian
Dear All, I am a beginner. Recently, I receive a project in perl. In some *.pm files, use Carp; . sub A warn "a warn message";

Re: foreach loop

2009-11-02 Thread Peter Scott
On Mon, 02 Nov 2009 13:06:27 +0530, Anant Gupta wrote: > Hello, > > In the foreach loop, without going to the beginning of the loop, i want > to get the next iteration of data. How do i get it. eg > > use strict; > open(FILE,"; > foreach my $line(@lines) > { > if($lin =~ m/something/) >

Re: Learning Perl Student Workbook

2009-11-02 Thread Peter Scott
On Mon, 02 Nov 2009 14:07:19 +0900, Raymond Wan wrote: > Perhaps the blame should be equally leveled at the web site and maybe it > should be brought to the attention of O'Reilly? You can bet O'Reilly knows about it. Those .ua sites have been going for years. Hard for a little US company to get

Re: tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread tom smith
On Mon, Nov 2, 2009 at 5:36 AM, Shameem Ahamed wrote: > > I think, it is installed successfully. > > Please run the below script to make sure that it is installed. > > use LWP::Simple; > > print "LWP/Simple.pm is installed in   $INC{'LWP/Simple.pm'} \n"; > $ perl --version This is perl, v5.8.6 bu

RE: Simple XML to XLS format

2009-11-02 Thread Bob McConnell
From: Shlomi Fish > On Saturday 31 Oct 2009 06:38:20 Ganesh Babu N wrote: >> CPAN modules are meant for Linux. It is very easy to install CPAN >> modules on Linux. >> >> Please refer http://www.cpan.org/modules/INSTALL.html >> > > First of all, CPAN modules are not meant for Linux in particular.

Re: foreach loop

2009-11-02 Thread John W. Krahn
Philip Potter wrote: 2009/11/2 Thomas Bätzler : while( my $line = <$file> ){ } Won't this loop terminate early if there is a blank line or a line containing only '0'? If I do a readline loop I always do: while (defined ($line = <$file>)) Is there something magical happening here I don't know

Re: Learning Perl Student Workbook

2009-11-02 Thread Shlomi Fish
On Monday 02 Nov 2009 07:19:30 Uri Guttman wrote: > > "RW" == Raymond Wan writes: > > RW> Uri Guttman wrote: > >>> "mb" == mahesh bhasme writes: > > mb> Hi, > mb> below link might help to u > > >> that is exactly what randal said he didn't want to see, a bootleg copy > >> o

Re: tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread Shameem Ahamed
Hello Tom, I am not able to find any reference to the file utf8_mode.al in base/message-charset.t Can you please try the below steps. wget http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/libwww-perl-5.833.tar.gz tar xzvf libwww-perl-5.833.tar.gz cd libwww-perl-5.833 perl Makefile.PL make make

Re: tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread tom smith
On Mon, Nov 2, 2009 at 3:45 AM, Shameem Ahamed wrote: > Tom, > > The make test it self returned error. > > So the problem is not with the cpan. Please check you have all the > dependencies met. You can paste the make test results here. It will show the > exact dependency errors. > > or else, get t

Re: tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread tom smith
On Mon, Nov 2, 2009 at 3:45 AM, Shameem Ahamed wrote: > Tom, > > The make test it self returned error. > > So the problem is not with the cpan. Please check you have all the > dependencies met. You can paste the make test results here. It will show the > exact dependency errors. > > or else, get t

Re: tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread Shameem Ahamed
Tom, The make test it self returned error. So the problem is not with the cpan. Please check you have all the dependencies met. You can paste the make test results here. It will show the exact dependency errors. or else, get the source from the below link http://search.cpan.org/CPAN/authors/i

AW: foreach loop

2009-11-02 Thread Thomas Bätzler
Philip Potter asked: > Won't this loop terminate early if there is a blank line or a line > containing only '0'? If I do a readline loop I always do: > while (defined ($line = <$file>)) > > Is there something magical happening here I don't know about? I know > about the magical: > > while (<$fil

tried to install my first module (Mac OSX 10.4.11)

2009-11-02 Thread tom smith
1) I did: $ sudo cpan which asked me a lot of questions. I accepted the defaults. 2) Then as described here: http://sial.org/howto/perl/life-with-cpan/macosx/ I did: cpan> o conf makepl_arg "INSTALLBIN=/usr/local/bin INSTALLSCRIPT=/usr/local/bin" cpan> o conf commit 3) Then I did: cpan>

suggestion for FAQ

2009-11-02 Thread tom smith
Hi, Nowhere in the FAQ does it list the address to which you can send your beginning programming questions. The FAQ lists the address for subscribing: beginners-subscr...@perl.org But the FAQ doesn't list the email address to which you can send your questions. For experienced list readers, it

Re: foreach loop

2009-11-02 Thread Philip Potter
2009/11/2 Thomas Bätzler : > while( my $line = <$file> ){ > > } Won't this loop terminate early if there is a blank line or a line containing only '0'? If I do a readline loop I always do: while (defined ($line = <$file>)) Is there something magical happening here I don't know about? I know abou

Re: foreach loop

2009-11-02 Thread Anant Gupta
Ohh, Thanks for the help On Mon, Nov 2, 2009 at 1:40 PM, John W. Krahn wrote: > Anant Gupta wrote: > >> Hello, >> > > Hello, > > In the foreach loop, without going to the beginning of the loop, i want to >> get the next iteration of data. How do i get it. >> eg >> >> use strict; >> open(FILE,">

Re: foreach loop

2009-11-02 Thread John W. Krahn
Anant Gupta wrote: Hello, Hello, In the foreach loop, without going to the beginning of the loop, i want to get the next iteration of data. How do i get it. eg use strict; open(FILE,"; foreach my $line(@lines) { if($lin =~ m/something/) { #some code # get next da

AW: foreach loop

2009-11-02 Thread Thomas Bätzler
Anant Gupta asked: > In the foreach loop, without going to the beginning of the loop, i want > to get the next iteration of data. How do i get it. You should probably not "slurp" (read in all at once) the file unless you need to. In your particular case reading i

Re: foreach loop

2009-11-02 Thread Erez Schatz
2009/11/2 Anant Gupta : > Hello, > > In the foreach loop, without going to the beginning of the loop, i want to > get the next iteration of data. How do i get it. > eg You can always use a for loop and refer to the next item: for (my $i= 0; $i< @lines; $i++) { if ($lines[$i + 1] == ... > use str