how to create your own module

2009-03-10 Thread itshardtogetone
Hi, I am using windowsXP and I have my perl installed in c:\perl I wish to write my own module and so I wrote a simple module and saved it in c:\perl\site\lib\mymod.pm but when I ran myscript below, nothing was printed out and the error msg was Global symbol @a requires explicit package name at

Re: regarding regular expression

2009-02-27 Thread itshardtogetone
- Original Message - From: John W. Krahn jwkr...@shaw.ca To: Perl Beginners beginners@perl.org Sent: Thursday, February 26, 2009 10:54 PM Subject: Re: regarding regular expression Irfan Sayed wrote: Hi All, Hello, I have a string like this

why while loop 6 times when @data have only 3 elements

2009-02-20 Thread itshardtogetone
Hi, Looking at the script below, why does the while function loop 6 times instead of 3 times when @data have only 3 elements and I thought the output should be:- 1 $_ = aaa1 2 $_ = bbb2 3 $_ = ccc3 Thanks # #!/usr/bin/perl use strict; use warnings;

Re: how to delay printing without over working perl

2009-02-11 Thread itshardtogetone
- Original Message - From: Chas. Owens chas.ow...@gmail.com To: itshardtogetone itshardtoget...@hotmail.com Cc: beginners@perl.org If you absolutely must avoid outputting data until after the loops are finished, you should probably write your output to a file and then display the file

question on 2 sub modules on the same scope

2009-02-09 Thread itshardtogetone
Hi, Looking at the script below, can someone explain why the final output is Final = 1 instead of Final = 5. I thought at the end of the while loop, $a_ctr is 5, this value is then read by the sub module data() and this value of 5 is then passed on to sub publish before its being printed out.

Re: question on 2 sub modules on the same scope

2009-02-09 Thread itshardtogetone
Original Message - From: David Shere dsh...@steelerubber.com To: itshardtogetone itshardtoget...@hotmail.com Cc: beginners@perl.org Sent: Tuesday, February 10, 2009 3:29 AM Subject: Re: question on 2 sub modules on the same scope What is an a_ctr, anyway? :) Thanks everyone

how to delay printing without over working perl

2009-02-09 Thread itshardtogetone
Hi, Looking at the script below, I wish to print out line 1 first, which is after the while loop, then followed by First loop, and then Second loop, henceforth I have the script below. What I did was to hold on the printing of First loop and Second loop by pushing them into @printer which was

free perl editor wanted

2009-02-08 Thread itshardtogetone
Can someone introduce me a free Perl editor that also can easily produce html codes. Thanks

Re: How hard is it to learn this langauge?

2009-02-08 Thread itshardtogetone
From: Blazer evanstroh...@yahoo.co.uk To: beginners@perl.org Sent: Sunday, February 08, 2009 7:05 AM Subject: How hard is it to learn this langauge? I just kept reading that Perl was a very easy language to learn. Is this true or is it propaganda??? Perl is quite easy to learn. Example if

how to print % when using printf

2009-02-06 Thread itshardtogetone
Hi, How do I print the % sign when using printf. I did the following which produced the following error illegal conversion in printf %) at line 185 printf (Total $total_number_of_bets\(%4.2f\%\) times.\n,$percentage_total_number_of_bets); Thanks

how to copy elements into the next array

2009-01-28 Thread itshardtogetone
Hi, How do I copy the first 10 elements of @a into @b? The method that I use is long :- my @a = 1..20; my @b = (); my $ctr = 0; foreach (@a){ if ($ctr 10){ push @b,$_; } $ctr ++; } Thanks.

using Win32::IEAutomation; how to maximize IE

2008-12-25 Thread itshardtogetone
Hi, I have the script below but IE did not maximize. What must I do to maximize IE. Thanks #!/usr/bin/perl use strict; use warnings; use Win32::IEAutomation; # Creating new instance of Internet Explorer my $ie = Win32::IEAutomation-new( visible = 1, maximize = 1); # Site navigation

data and script in same location, how to write it down

2008-12-14 Thread itshardtogetone
Hi, I wish to open a file datafile.txt which is stored in the same location as the perl script, so how do I write it down? open (FILE,'', ) || die no such files $!\n; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional

how to use module when not installed by web-hosting company

2008-12-07 Thread itshardtogetone
Hi, My website is hosted in 110mb.com and they do not have this module installed Algorithm::Numerical::Shuffle qw /shuffle/; So what can I do to use that module. Thanks

why cant I see any hex values in the following simple form when submitted

2008-12-07 Thread itshardtogetone
Hi, I have a simple script to read the inputs of a simple form. I just wanted to see what is read by this script when the form is submitted. Upon submission of the form, the script print the following : name=simon+garfunkalemail=asdfdsasdf.asdf.comage=12favorite_color=pink Usually a script to

script ok but produce error when run in a homepage

2008-11-22 Thread itshardtogetone
Hi, Looking at the script below which when uploaded into my homepage in wave.prohosting.com, and when I ran the script, I got an error which says Error 500 Internal Server Error . After several debugging, I realised that if I comment-out the shuffle-module (#use Algorithm::Numerical::Shuffle

whats the perl command to run/execute a program or script

2008-11-05 Thread itshardtogetone
Hi, Whats the perl command to run a script or program. Thanks

how do I install perl into thumbdrive

2008-10-21 Thread itshardtogetone
Hi, I move around quite alot. So how do I install perl into my thumbdrive. I did a yahoo search and I found one but too technical == http://www.perlmonks.org/?node=Portable+perl%3A+usb+thumbdrive Thanks

whats the location of my perl script

2008-10-19 Thread itshardtogetone
Hi, What is the command to recall the drive location of my script? Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: how to fill in forms of yahoo sign up site

2008-10-08 Thread itshardtogetone
From: Randal L. Schwartz [EMAIL PROTECTED] To: beginners@perl.org Sent: Sunday, October 05, 2008 2:49 PM Subject: Re: how to fill in forms of yahoo sign up site itshardtogetone == itshardtogetone [EMAIL PROTECTED] writes: itshardtogetone I want to have a program to autofill those yahoo

how to fill in forms of yahoo sign up site

2008-10-05 Thread itshardtogetone
Hi, I want to have a program to autofill those yahoo signup forms such as this == https://edit.yahoo.com/registration?.v=.intl=sgnew=1.src=ym.partner=.p=promo=.last=.done=http://sg.yahoo.com/ The names, and other details are saved in a text file. How do I do this? Thanks

Internet explorer viewing options, run script but was prompted to download

2008-09-28 Thread itshardtogetone
Hi, I use internet explorer 7.0 to browse the website. I upload a simple script, helloworld.cgi, to my website but when I ran the script by typing the url, www.myurl.com/cgi-bin/helloworld.cgi, instead of executing the script, I was prompted to download the script. What must I do. Thanks

how to produce random dates

2008-09-20 Thread itshardtogetone
Hi, How do I randomly produce a date between 1st Jan 1960 to 31th December 1985. It must be able to show the day month year. I only know how to produce a random number between 1960 to 1985 using rand like this : my $year = int (rand 26) + 1960; Thanks

how to round off a decimal to the next whole number

2008-08-05 Thread itshardtogetone
Hi, How do I round off a decimal to the next nearest whole digit , example 0.123 = 1, 1.23 = 2, 4.7312 = 5, etc etc. Right now I can only do the above by extracting the first digit using splice , then add one. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

how to install modules

2008-05-30 Thread itshardtogetone
Hi, I tried to install the module plot.pm, by following the undermentioned method http://www.base64.co.uk/installing-perl-modules/ but I failed. What have I missed? I am using windowsXP. I am using Perl-5-10. I installed perl in c:\perl\. To install the module plot.pm, using the methods below,

Re: how to plot graphs

2008-05-28 Thread itshardtogetone
From: yitzle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: beginners@perl.org Sent: Tuesday, May 27, 2008 7:55 AM Subject: Re: how to plot graphs You can use a module off CPAN. A quick search gave me this: http://search.cpan.org/~smorton/Chart-Plot-0.11/Plot.pm Hi, Thanks. I have activeperl

Re: how to plot graphs

2008-05-27 Thread itshardtogetone
- Original Message - From: yitzle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: beginners@perl.org Sent: Tuesday, May 27, 2008 7:55 AM Subject: Re: how to plot graphs You can use a module off CPAN. A quick search gave me this: http://search.cpan.org/~smorton/Chart-Plot-0.11/Plot.pm

Re: how to plot graphs

2008-05-27 Thread itshardtogetone
From: Rob Dixon [EMAIL PROTECTED] To: beginners@perl.org Cc: [EMAIL PROTECTED] Sent: Wednesday, May 28, 2008 2:51 AM Subject: Re: how to plot graphs snip off There is no need to restrict yourself to an Excel row to hold graph x-axis values. More often a spreadsheet column will be used to

how to simplify this script

2008-05-03 Thread itshardtogetone
Hi, In the script below, I have an array @datas with its elements consisting of numbers like this :- my @datas = ( '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9', '1 6 7', '1 7 12', '2 6 7', '4 5 10', '4 5 15' ); Out of the above list, I wish to generate a seperate array so that among

Re: how to simplify this script

2008-05-03 Thread itshardtogetone
From: Richard Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: beginners@perl.org Sent: Sunday, May 04, 2008 3:17 AM Subject: Re: how to simplify this script I don't have the solution yet but shouldn't the answer be 1 6 7 and 4 5 10 only ? it's printing out 1 2 3 as well which is wrong? Thanks

Re: how to simplify this script

2008-05-03 Thread itshardtogetone
Hi Gunnar and Members I am very thrilled with your solutions. Is 'LOOP' as in LOOP: foreach ( @datas ) { = a function or a command etc. I could not find this function in http://perldoc.perl.org/index-functions.html#L Thanks - Original Message - From: Gunnar

how to reun perl script on other pc without having to install perl

2008-05-03 Thread itshardtogetone
Hi, What must I do to my perl script so that my friends can run my perl script from their computer, using windows as the operating system, without having to install perl into their system. Technically, this conversion is it called compiling? Thanks

howto simplfy this regex if ($string =~/^$match | $match | $match$/g){

2008-05-03 Thread itshardtogetone
Hi, How do I simplify the regex below so that it matches only the number 1, henceforth it should return false if I match $string with $match. use strict; use warnings; my $string = 10 11 12 13 40; my $match = 1; if ($string =~/^$match | $match | $match$/g){ print match; }else{ print

question on foreach loop

2008-05-01 Thread itshardtogetone
Hi Members, Can someone explain why the foreach loop did not iterate 10 times. Thanks # use strict; use warnings; my @data = (1..10); foreach (@data){ splice @data,0,1; print printing [EMAIL PROTECTED] = @data\n; } # results ### printing @data = 2 3 4 5 6 7

Re: grabbing text between two tokens

2008-04-14 Thread itshardtogetone
Thanks Gary, But some of us may wish to know why $str =~ m/tokena(.*)tokenb/ms; did not get all the things between tokena and tokenb into $str? This is how my mind think:- (1) The /s switch means to be able to match across newlines. (2) .* means to match zero or more of anything. Henceforth

Re: how to construct regex to count no. of alphabets in a scalar variable

2008-04-13 Thread itshardtogetone
my $count = () = $str =~ /a/g; Thanks Chas. Owens, I need some explanation on the above on how the above regex count the number of 'a' in a string. With my limited understanding, this is what I thought:- $count = () ; #To me it means $count is assigned with a undefined value which is then

how to construct regex to count no. of alphabets in a scalar variable

2008-04-12 Thread itshardtogetone
Hi, How do I construct a regex to count the number of 'a' within a scalar variable such as the undermentioned. One method I can think of is to split the scalar string into a list and then do the counting but I just feel that this in not necessary. Thanks { my $string = 'hello there are many a

Re: Testing an array for a match

2008-04-10 Thread itshardtogetone
Hi, How about this :- foreach (@Treasures){ if ($_=~ /:1:2:3:/){ print do your stuffs here\n: } } - Original Message - From: Lou Hernsen [EMAIL PROTECTED] To: beginners@perl.org; [EMAIL PROTECTED] Sent: Thursday, April 10, 2008 1:07 AM Subject: Testing an array for a

Re: how to globalize a lexical variable inside a sub routine

2008-04-10 Thread itshardtogetone
Thanks Jenda, Chas.Owens and fellow members. What do you mean by globalise? Jenda Looking at the script below, in diagram 1, $capital will not be incremented unless I write it as in diagram 2. Just because I do not want $capital to be reset on each foreach loop, I then have to declare

variable will not stay shared

2008-04-10 Thread itshardtogetone
Hi Members, 1)The script below produce the following warnings:- variable $betting_system will not stay shared at roulette.pl line 61. What is the problem and how do I rectify this problem. 2)How do I shorten/improve this script. Thanks # start of script #

how to globalize a lexical variable inside a sub routine

2008-04-09 Thread itshardtogetone
Hi, Assuming my script use a strict pragma. If I have a lexical variable declared inside a sub routine and I wish to globalize this lexical variable, what are the various options to globalise this variable? Thanks ### use strict; use warnings; testing(); sub testing { my

questions from Learning Perl

2008-04-06 Thread itshardtogetone
Hi, I am doing some homework from the book Learning Perl chapter 4 excercise 1, Looking at the script below, I wonder why line 6 (print Enter some numbers on separate line: ;) is not printed immediately after the previous print. Thanks use strict; use warnings; my @fred = qw/1 3 5 7 9/; my

using regex, how to erase off all blank spaces

2008-04-05 Thread itshardtogetone
Hi, The script below is suppose to erase off, from a file, all blank lines including newlines, I wrote the regex is as follows : s/^\s*$//; however after running the script, a last newline remains. Can someone explain why the regexp can erase off all newlines in the file except the last

question on s///;

2008-04-03 Thread itshardtogetone
Hi, With regards to the script below, inside the foreach loop, can someone explain to me why the expression $_=~ s/\nfred\n/nancy/; did not change the default variable $_ from fred (enclosed by \n) to nancy. Thanks # start of script ### use strict; open (MYDATA,

Re: how to extract the last digit

2008-04-02 Thread itshardtogetone
Thanks everyone for the help! I get an error on 'chop' when I use the following. Why is this so? Thanks use strict; use warnings; my @eightdecks = 1..20; my $last = chop ($eightdecks[0] + $eightdecks[2]); if ($last =~ /[0-5]/){ print yes match.\n; }else{print not match\n}; - Original

how to write 0 to 10 in reg exp.

2008-04-02 Thread itshardtogetone
Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdecks match 0 to 10. So i want the answer to be yes. Thanks my $eightdecks = 6; if($eightdecks =~ /[0-10]/){ print Yes match\n; }else{print no};

Re: simple reg ex matching

2008-04-02 Thread itshardtogetone
ok, I found my error, it should be as follows if I want to match number 6:- my $_ = 62; if( $_ =~ /^6$/){ - Original Message - From: [EMAIL PROTECTED] To: beginners@perl.org Sent: Wednesday, April 02, 2008 5:07 PM Subject: simple reg ex matching Hi, The value of $_ is 62. In the

simple reg ex matching

2008-04-02 Thread itshardtogetone
Hi, The value of $_ is 62. In the script below, I just wonder why the default variable match the number 6. What I wanted to say is that if the default variable $_ holding the value of 62, if match the number 6, then print Yes match. So what is the right way to right. Thanks use strict; use

how to extract the last digit

2008-04-01 Thread itshardtogetone
Hi, How do I extract the last digit of a number? example I only want the digit 9 from the number 19. my $number = 19;

Re: question on lexical declaration and submodule

2008-03-27 Thread itshardtogetone
- Original Message - From: Gunnar Hjalmarsson [EMAIL PROTECTED] To: beginners@perl.org Sent: Thursday, March 27, 2008 8:27 AM Subject: Re: question on lexical declaration and submodule ... but I dont think this is a good idea as the sub-module will then have a mixture of both

question on lexical declaration and submodule

2008-03-26 Thread itshardtogetone
Hi, I am doing some studies on sub modules and Lexical variables (my). With regards to diagram 1 below, what can I do so that the lexical $counter can count up to 4. Of course, one way of doing this is to change the lexical $counter into a global variable as seen in diagram 2 but I dont think

Re: how do I shorten this code

2008-03-24 Thread itshardtogetone
Hi , Looking at the reg expression ( $playercard1 =~ /10|J|Q|K/ ), it will match 0, 1, and '10' , J, Q, K What must I do so that it will match only '10' , 'J', 'Q', and 'K' Thanks - Original Message - From: Rodrick Brown [EMAIL PROTECTED] #!/usr/bin/perl -w use strict; use

why variable inside submodule did not change value

2008-03-22 Thread itshardtogetone
Hi, With regards to the script below, can somebody explain to me why $testcounter after counting 1,2,3, remains at 3 all the time. I thought it would have been reset to zero by the outer while loop. Thanks #!c:\perl\bin\perl use strict; my $anything = 5; my $counter =0; while ($anything

Re: why variable inside submodule did not change value

2008-03-22 Thread itshardtogetone
Thanks Rob and members, What do you mean by but since you have declared a subroutine that references the variable Thank You. Ed - Original Message - From: Rob Dixon [EMAIL PROTECTED] To: beginners@perl.org Cc: [EMAIL PROTECTED] Sent: Sunday, March 23, 2008 9:06 AM Subject: Re:

whats wrong with this error msg Illegal division by zero

2008-03-15 Thread itshardtogetone
Hi, Members The script below produce an error at the printf function at line 342 which says Illegal division by zero at \perl\baccarat.pl line 342.. Can someone tell me whats wrong. Thanks partial script=== my $total = $banker_counter + $player_counter; open

how to search manual for use strict

2008-03-13 Thread itshardtogetone
Hi, I want to read the installed perl manual on use strict, so how do I search the perl manual for use strict Thanks

Re: how do I shorten this code

2008-03-11 Thread itshardtogetone
Hi, How do I shorten this code:- if $playercard1 = 10 or $playercard1 = J or $playercard1 = Q or $playercard1 = K; Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: how do I shorten this code

2008-03-11 Thread itshardtogetone
Thank You very much everyone here. Thanks for providing me leads to study. - Original Message - John W. Krahn [EMAIL PROTECTED], Rodrick Brown wrote: Tom Phoenix Gunnar Hjalmarsson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how and where to install module

2008-03-09 Thread itshardtogetone
Thanks, Ok, I have successfully installed Algorithm::Numerical::Shuffle using the activestate PPM. I am using windowsXP. I have installed Perl in c:\perl So how do I use the above installed shuffle module to shuffle the list below :- @cards = (1,2,3,4,5,6,7,8,9,10); Thanks - Original

Re: how and where to install module

2008-03-09 Thread itshardtogetone
ok, this is what I have tried but I got and internal system error msg like this An internal system error has occurred which prevents us from responding to your request. - start of script-- use Algorithm::Numerical::Shuffle; Shuffle @baccarat =

Re: how and where to install module

2008-03-09 Thread itshardtogetone
Thanks, Ok, I have successfully installed Algorithm::Numerical::Shuffle using the activestate PPM. I am using windowsXP. I have installed Perl in c:\perl So how do I use the above installed shuffle module to shuffle the list below :- @cards = (1,2,3,4,5,6,7,8,9,10); Thanks - Original

how do I shorten this code

2008-03-09 Thread itshardtogetone
Hi, I wish to shuffle 8 decks of cards, so how do I shorten this code :- use Algorithm::Numerical::Shuffle qw /shuffle/; @eightdecks = shuffle (1..10,J,Q,K,1..10,J,Q,K,1..10,J,Q,K);#how do I repeat 1 to K 32 times print @eightdecks ;

free servers wanted

2008-03-08 Thread itshardtogetone
Hi, I wish to run my perl/cgi scripts from Windows Internet explorer in offline mode, therefore I need to activate some kind of servers, can someone here recommend me some free servers. Thanks Jim. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

off topic Re: free servers wanted

2008-03-08 Thread itshardtogetone
Thanks everyone for the help. Originally I intent to use sambar but it has recently discontinue. I wanted to use apache but it seems quite difficult to get it up, please correct me if I am wrong. As I am getting the server just to run my perl script in MS Internet explorer, for learning

why error in this == print hello world;

2008-03-08 Thread itshardtogetone
Hi, Why do I get error for this :- print hello world; Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

how and where to install module

2008-03-08 Thread itshardtogetone
Hi, I wish to use the module shuffle from cpan. I have downloaded perl to c:\perl so where do I install the module to? thanks