Re: Redirecting to another url with parameters using post method

2007-08-25 Thread Jeff Pang
2007/8/25, Praveena Vittal <[EMAIL PROTECTED]>: > Hi , > > I want to redirect to a different url with the parameters in the post > method. > Well,see 'perldoc CGI' and specially check for, param, redirect. Good luck! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Recurse into an HTML tree?

2007-08-25 Thread johnspeth
Hi Group- (Please excuse me if this post is a duplicate - free news servers aren't reliable) I'm trying to figure out how to recursively scan an HTML tree. Through trial and error I've arrived at the solution below except I'm stumped on how to recurse into the next level. I can't seem to find a

Re: Convert from unix newlines to dos newlines

2007-08-25 Thread Xavier Noria
On Aug 25, 2007, at 4:54 AM, Yoyoyo Yoyoyoyo wrote: I use a mac and I was wondering if there was a way to convert unix newlines in a text file to dos newlines. Yeah, with a Perl one-liner it would be perl -pi -we 's/\n/\r\n/' file.txt or perl -pi.bak -we 's/\n/\r\n/' file.txt if you w

Re: Recurse into an HTML tree?

2007-08-25 Thread Chas Owens
On 8/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: snp > I'm trying to figure out how to recursively scan an HTML tree. snip #!/usr/bin/perl use strict; use warnings; use HTML::TreeBuilder; my $tree = HTML::TreeBuilder->new(); $tree->parse_file("t.html"); recurse($tree); sub recurse {

Re: unfamiliar array reference

2007-08-25 Thread petelink1
On Aug 24, 9:03 am, [EMAIL PROTECTED] (Paul Lalli) wrote: snip > > 'our', like 'my', is lexically scoped. Its effects are terminated > when the innermost enclosing block ends. So if you're using the same > package variable in two different blocks, you have to use 'our' in > each of them: > Yes

Re: unfamiliar array reference

2007-08-25 Thread Chas Owens
On 8/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: snip > No, the version of DBI that I am using is very current so apparently > the DBI book is current on that issue also. Using your code above > (same as book) worked fine. snip Ah, I knew there was a reason beyond readability that I prefe

Re: unfamiliar array reference

2007-08-25 Thread Paul Lalli
On Aug 25, 6:09 am, [EMAIL PROTECTED] (Chas Owens) wrote: > Ah, I knew there was a reason beyond readability that I preferred > fetchrow_hashref: > > from perldoc DBI >"fetchrow_arrayref" >Note that the same array reference is returned for each fetch, >"fetchrow_hashre

Re: Convert from unix newlines to dos newlines

2007-08-25 Thread Yoyoyo Yoyoyoyo
Thanks, but quick question. If I do it from the command line it works fine. But if I add: `perl -pi -we 's/\n/\r\n/' ./student.csv`; to my perl script it doesn't make the change to the file. Is there a reason for this? Robert Xavier Noria <[EMAIL PROTECTED]> wrote: On Aug 25, 2007, at 4:5

Re: Convert from unix newlines to dos newlines

2007-08-25 Thread Xavier Noria
On Aug 25, 2007, at 4:53 PM, Yoyoyo Yoyoyoyo wrote: Thanks, but quick question. If I do it from the command line it works fine. But if I add: `perl -pi -we 's/\n/\r\n/' ./student.csv`; to my perl script it doesn't make the change to the file. Is there a reason for this? Sure, the lite

Convert int for string

2007-08-25 Thread Rodrigo Tavares
Hello, In many languages there is a function for convert int for string. Ho I can do it in Perl ? Best regards, Rodrigo Faria Flickr agora em português. Você clica, todo mundo vê. http://www.flickr.com.br/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

Re: Convert int for string

2007-08-25 Thread Jeff Pang
2007/8/26, Rodrigo Tavares <[EMAIL PROTECTED]>: > Hello, > > In many languages there is a function for convert int > for string. Ho I can do it in Perl ? > Hello, Perl isn't a strong type language like C,so you don't have the need to convert the variable type distinctly. for example, my $x = 123

Re: Convert int for string

2007-08-25 Thread Rodrick Brown
On 8/25/07, Jeff Pang <[EMAIL PROTECTED]> wrote: > 2007/8/26, Rodrigo Tavares <[EMAIL PROTECTED]>: > > Hello, > > > > In many languages there is a function for convert int > > for string. Ho I can do it in Perl ? > > > > Hello, > > Perl isn't a strong type language like C,so you don't have the need

Re: Convert int for string

2007-08-25 Thread Rodrigo Tavares
Hello Jeff, See this simple script: print "Enter with the fisrst number\n"; my $num = ; How I can to convert variable $num, in string ? Best regards, Rodrigo Faria --- Jeff Pang <[EMAIL PROTECTED]> escreveu: > 2007/8/26, Rodrigo Tavares > <[EMAIL PROTECTED]>: > > Hello, > > > > In many la

Re: Convert int for string

2007-08-25 Thread Jeff Pang
2007/8/26, Rodrigo Tavares <[EMAIL PROTECTED]>: > Hello Jeff, > > See this simple script: > > print "Enter with the fisrst number\n"; > my $num = ; > > How I can to convert variable $num, in string ? > This is really depend on what operation context the variable is in. As I've said,when you use it

Re: Convert int for string

2007-08-25 Thread Rodrigo Tavares
Hello, I want to convert the int for string, then use the function lenght, and return the size of string. How It is possible ? Best regards, Rodrigo Faria --- Jeff Pang <[EMAIL PROTECTED]> escreveu: > 2007/8/26, Rodrigo Tavares > <[EMAIL PROTECTED]>: > > Hello Jeff, > > > > See this simple s

subroutine references

2007-08-25 Thread Chris
I'm working on yet another exercise from Intermediate Perl. I've been given a script that searches for files that fall between a two timestamps. For the exercise, I am supposed to write the gather_mtime_between subroutine that will return two references to two subroutines. One will use File::Fin

Re: Convert int for string

2007-08-25 Thread Mr. Shawn H. Corey
Rodrigo Tavares wrote: Hello, I want to convert the int for string, then use the function lenght, and return the size of string. How It is possible ? Perl automatically converts a number to and string (and back again) as needed. To get the length of its string, use the length function: my

Re: Convert int for string

2007-08-25 Thread Tom Phoenix
On 8/25/07, Rodrigo Tavares <[EMAIL PROTECTED]> wrote: > In many languages there is a function for convert int > for string. Ho I can do it in Perl ? It's so easy to put a number into a string, we don't have a function for it. We simply interpolate: my $age = 6 * 7; # or any other number pri

Re: subroutine references

2007-08-25 Thread Tom Phoenix
On 8/25/07, Chris <[EMAIL PROTECTED]> wrote: > if (my $start <= $timestamp <= my $stop){ Until Perl 6, you have to break down chain comparisons like this into separate comparisons, usually joined with 'and': if ($start <= $timestamp and $timestamp <= $stop) { ... } But the real problem

Re: subroutine references

2007-08-25 Thread Mr. Shawn H. Corey
Chris wrote: I'm working on yet another exercise from Intermediate Perl. I've been given a script that searches for files that fall between a two timestamps. For the exercise, I am supposed to write the gather_mtime_between subroutine that will return two references to two subroutines. One wil

Re: subroutine references

2007-08-25 Thread Mr. Shawn H. Corey
Mr. Shawn H. Corey wrote: Chris wrote: I'm working on yet another exercise from Intermediate Perl. I've been given a script that searches for files that fall between a two timestamps. For the exercise, I am supposed to write the gather_mtime_between subroutine that will return two references t

Printing asterisks in screen

2007-08-25 Thread Rodrigo Tavares
Hello, I bought a book about Programming Perl, there is a exercise : 1) Enter with a number and print asterisks (1..30) ex: if you type six have go to screen: ** See the below code : if (($num1 >= 1 && $num1 <= 30) { for (my $i=1 ; $i < 30 ; $i++) { while ($num1 == $i)

Re: Convert int for string

2007-08-25 Thread Dr.Ruud
Rodrigo Tavares schreef: > print "Enter with the fisrst number\n"; > my $num = ; > > How I can to convert variable $num, in string ? $num already contains a string. When you input 1 2 3 , it will contain "123\n". With chomp() you can remove the newline, but you can also use int(), see `perldoc -

Re: subroutine references

2007-08-25 Thread Dr.Ruud
Shawn schreef: > Chris: >> I'm working on yet another exercise from Intermediate Perl. I've >> been given a script that searches for files that fall between a two >> timestamps. For the exercise, I am supposed to write the >> gather_mtime_between subroutine that will return two references to >>

Re: Printing asterisks in screen

2007-08-25 Thread Ken Foskey
On Sat, 2007-08-25 at 16:36 -0300, Rodrigo Tavares wrote: > if (($num1 >= 1 && $num1 <= 30) > { > for (my $i=1 ; $i < 30 ; $i++) > { > while ($num1 == $i) > { > print "*"; > } > } > } Think in terms of values: Use 6 instead of $num1 and thin

Re: Printing asterisks in screen

2007-08-25 Thread Gunnar Hjalmarsson
Rodrigo Tavares wrote: 1) Enter with a number and print asterisks (1..30) ex: if you type six have go to screen: ** if ( $num >= 1 and $num <= 30 ) { print '*' x $num, "\n"; } if (($num1 >= 1 && $num1 <= 30) { for (my $i=1 ; $i < 30 ; $i++) { while ($n

Re: Redirecting to another url with parameters using post method

2007-08-25 Thread Gunnar Hjalmarsson
Jeff Pang wrote: 2007/8/25, Praveena Vittal <[EMAIL PROTECTED]>: I want to redirect to a different url with the parameters in the post method. Well,see 'perldoc CGI' and specially check for, param, redirect. How do you combine a POST request and a 'Location:' header (which is what CGI::red

Re: subroutine references

2007-08-25 Thread Chris
Ok, if anyone is interested, here is my answer: #!/usr/bin/perl -w # Testing code for Exercise 6-1. Your task is to write the sub # gather_mtime_between. use strict; use File::Find; use Time::Local; my ($start, $stop) = @_; my @starting_directories = @_; my @found_items; sub gather_mtime_betw

Re: Printing asterisks in screen

2007-08-25 Thread John W. Krahn
Rodrigo Tavares wrote: Hello, Hello, I bought a book about Programming Perl, there is a exercise : 1) Enter with a number and print asterisks (1..30) ex: if you type six have go to screen: ** See the below code : if (($num1 >= 1 && $num1 <= 30) { for (my $i=1 ; $i < 30 ; $i++)

Re: Redirecting to another url with parameters using post method

2007-08-25 Thread Mumia W.
On 08/25/2007 04:32 PM, Gunnar Hjalmarsson wrote: Jeff Pang wrote: 2007/8/25, Praveena Vittal <[EMAIL PROTECTED]>: I want to redirect to a different url with the parameters in the post method. Well,see 'perldoc CGI' and specially check for, param, redirect. How do you combine a POST reques

Re: subroutine references

2007-08-25 Thread Dr.Ruud
Chris schreef: > #!/usr/bin/perl -w Toss the -w, and insert a "use warnings;". > my ($start, $stop) = @_; > my @starting_directories = @_; This doesn't do what I think that you think it does. > my($sec, $min, $hour, $day, $mon, $yr, $dow) = localtime; Is the start/top related to today? What

Re: Redirecting to another url with parameters using post method

2007-08-25 Thread Gunnar Hjalmarsson
Mumia W. wrote: On 08/25/2007 04:32 PM, Gunnar Hjalmarsson wrote: Jeff Pang wrote: 2007/8/25, Praveena Vittal <[EMAIL PROTECTED]>: I want to redirect to a different url with the parameters in the post method. Well,see 'perldoc CGI' and specially check for, param, redirect. How do you comb

Re: Convert int for string

2007-08-25 Thread Randal L. Schwartz
> ""Jeff" == "Jeff Pang" <[EMAIL PROTECTED]> writes: "Jeff> Perl isn't a strong type language like C,so you don't have the need to "Jeff> convert the variable type distinctly. Perl is a very strongly typed language. The problem is that people keep thinking "number" or "string" is a type in P

Re: Redirecting to another url with parameters using post method

2007-08-25 Thread yitzle
On 8/25/07, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > >>> 2007/8/25, Praveena Vittal <[EMAIL PROTECTED]>: > I want to redirect to a different url with the parameters in the post > method. > This is the last para of that section: > "If the 307 status code is received in response to

Re: Redirecting to another url with parameters using post method

2007-08-25 Thread Gunnar Hjalmarsson
yitzle wrote: On 8/25/07, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: So I don't think that 307 is the proper status code for a redirect via a POST request. 307 sounds right. The user agent (ie usually the internet browser) will tell the user that there is a redirect, does the user want to p

Re: Redirecting to another url with parameters using post method

2007-08-25 Thread Mumia W.
On 08/25/2007 07:39 PM, Gunnar Hjalmarsson wrote: Mumia W. wrote: On 08/25/2007 04:32 PM, Gunnar Hjalmarsson wrote: Jeff Pang wrote: 2007/8/25, Praveena Vittal <[EMAIL PROTECTED]>: I want to redirect to a different url with the parameters in the post method. Well,see 'perldoc CGI' and spec