Re: Premature end of script headers

2007-06-12 Thread Mike Williams
Saravanan, Hi there. Please do a reply to all to keep this on the list. Someone else may be able to help, and someone else may be helped in the future if it lands in the list archives. On 6/12/07, saravanan Jagadeesan [EMAIL PROTECTED] wrote: Mike, Thanks for your info mike , i

Database insertion, escape issue

2007-06-12 Thread Northstardomus
I have a Perl script where I try to strip some data from a web page and insert it into a database. I'm having a problem where, it seems like the method of quoting the data for insertion don't seem to be working (as far as escaping the text) and some of the text is ending up getting injected

Re: Database insertion, escape issue

2007-06-12 Thread Tom Allison
On Jun 11, 2007, at 7:52 PM, Northstardomus wrote: I have a Perl script where I try to strip some data from a web page and insert it into a database. I'm having a problem where, it seems like the method of quoting the data for insertion don't seem to be working (as far as escaping the

Re: Database insertion, escape issue

2007-06-12 Thread Mumia W.
On 06/11/2007 06:52 PM, Northstardomus wrote: [...] print br/Inserting into Database , @values.; Use the quotemeta function to escape special characters that may be in the values. my @values_copy = @values; @values = map quotemeta($_), @values;

Leading zeros kept or not kept while increment or decrement

2007-06-12 Thread Angerstein
Perl does $x=0001; $x++; print $x; Output: 0002 BUT $x=0002; $x--; print $x; Output: 1 Why and how can I avoid that. (yes, i know about printf) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Leading zeros kept or not kept while increment or decrement

2007-06-12 Thread Adriano Ferreira
On 6/12/07, Angerstein [EMAIL PROTECTED] wrote: Perl does $x=0001; $x++; print $x; Output: 0002 BUT $x=0002; $x--; print $x; Output: 1 Why and how can I avoid that. (yes, i know about printf) So use it ;-) Read the section Auto-increment and Auto-decrement in perldoc perlop which ends

Re: Annoying HASH(0x...) in Output

2007-06-12 Thread Jenda Krynicky
From: Tom Phoenix [EMAIL PROTECTED] On 6/4/07, GMan [EMAIL PROTECTED] wrote: Things go smoothly for a while, and things seem quiet. Too quiet. Then... sub addfriend { my ($self,$f) = @_; #dereference the array from the hash $fr = $self-{'_friends'}; @friends = @$fr;

Re: Database insertion, escape issue

2007-06-12 Thread Jenda Krynicky
From: Mumia W. [EMAIL PROTECTED] On 06/11/2007 06:52 PM, Northstardomus wrote: [...] print br/Inserting into Database , @values.; Use the quotemeta function to escape special characters that may be in the values. Please don't! my @values_copy = @values; @values =

Re: Declaring constants in perl

2007-06-12 Thread Jenda Krynicky
From: Paul Lalli [EMAIL PROTECTED] On Jun 8, 7:33 am, [EMAIL PROTECTED] (Alok Nath) wrote: What is the convention used to declare constants in perl ? In C we declare constant type in Capital letters , not sure how its in perl. There is a 'constant' pragma in Perl

Re: Declaring constants in perl

2007-06-12 Thread Paul Lalli
On Jun 12, 9:48 am, [EMAIL PROTECTED] (Jenda Krynicky) wrote: Everything has it's pros and cons. 1) The constant pragma is already installed with any Perl 5.004 or newer, while you have to install Readonly.pm Agreed, but with the availability of CPAN.pm and the relative ease with which

Re: Is there an EXIF for video files ?

2007-06-12 Thread Jenda Krynicky
Date sent: 11 Jun 2007 21:40:40 - To: beginners@perl.org Subject:Is there an EXIF for video files ? From: TDJ [EMAIL PROTECTED] Organization: ACME I use a Perl script to download images from my digital camera, and

Re: Database insertion, escape issue

2007-06-12 Thread Northstardomus
On Jun 12, 8:48 am, [EMAIL PROTECTED] (Jenda Krynicky) wrote: From: Mumia W. [EMAIL PROTECTED] On 06/11/2007 06:52 PM, Northstardomus wrote: [...] print br/Inserting into Database , @values.; Use the quotemeta function to escape special characters that may be in the values.

regex for matching repeated strings

2007-06-12 Thread James
Is there a way of writing a regex to find 1 or more occurances of specific text string, and replace with a single occurance. e.g.: data tag AI01 AI01 AI01 AI01 needs to be replaced with data tag AI001 thus (m/(AI\d{6}\n)/) will find one occurance and capture as $1

Net::Telnet - Variable in Prompt

2007-06-12 Thread Lakshmi Sailaja
Hi, Is there a way to use a variable in the Prompt parameter like the below line? my $telnet = Net::Telnet-new([HOST = $server,] [PROMPT = /$prompt/,]); Thanks Regards, Lakshmi 952-833-1220 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: regex for matching repeated strings

2007-06-12 Thread John W. Krahn
James wrote: Is there a way of writing a regex to find 1 or more occurances of specific text string, and replace with a single occurance. e.g.: data tag AI01 AI01 AI01 AI01 needs to be replaced with data tag AI001 thus (m/(AI\d{6}\n)/) will find one occurance and

Perl directory listing program

2007-06-12 Thread [EMAIL PROTECTED]
Looking for some help here you perl geniuses you : ) I need a program that will list all of the files in a directory. Without any arguments the program will list only the files (not directories) in the current directory. But I must have some command line options: -d with 0 or 1 directory

Re: Perl directory listing program

2007-06-12 Thread Beginner
On 12 Jun 2007 at 16:26, [EMAIL PROTECTED] wrote: Looking for some help here you perl geniuses you : ) I need a program that will list all of the files in a directory. Without any arguments the program will list only the files (not directories) in the current directory. But I must have

Re: regex for matching repeated strings

2007-06-12 Thread Chas Owens
On 6/12/07, James [EMAIL PROTECTED] wrote: Is there a way of writing a regex to find 1 or more occurances of specific text string, and replace with a single occurance. Possibly, but using a hash is a lot easier and probably more efficient: #!/usr/bin/perl use strict; use warnings; my %h;

Re: regex for matching repeated strings

2007-06-12 Thread yitzle
Issues with both methods: John's doesn't work for this data: aa aa bbb cc cc I would expect: aa bbb cc I would get: aa bbb cc cc With the solution by Chas and the data: aa aa bbb aa aa I expect: aa bbb aa I get: aa bbb -- To

Re: Perl directory listing program

2007-06-12 Thread Chas Owens
On 6/12/07, Beginner [EMAIL PROTECTED] wrote: snip perldoc -f format # For an alternative way to format some headers. snip I would suggest using Perl6::Form instead of the built-in format handling. The built-in format pretty much forces you to use bad style. *

Re: regex for matching repeated strings

2007-06-12 Thread Chas Owens
On 6/12/07, yitzle [EMAIL PROTECTED] wrote: Issues with both methods: snip If you only want to reduce runs (as opposed to removing dups) then #!/usr/bin/perl use strict; use warnings; my $cur = undef; while (DATA) { print unless defined $cur and $_ eq $cur; $cur = $_; }

Re: Perl directory listing program

2007-06-12 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Looking for some help here you perl geniuses you : ) I need a program that will list all of the files in a directory. Without any arguments the program will list only the files (not directories) in the current directory. But I must have some command line options: -d

Re: regex for matching repeated strings

2007-06-12 Thread John W. Krahn
yitzle wrote: Issues with both methods: John's doesn't work for this data: aa aa bbb cc cc I would expect: aa bbb cc I would get: aa bbb cc cc It works for me: $ perl -le' my $data = q[aa aa bbb cc cc ]; print $data; $data =~

Re: Net::Telnet - Variable in Prompt

2007-06-12 Thread Martin Barth
On Tue, 12 Jun 2007 11:56:12 -0500 Lakshmi Sailaja [EMAIL PROTECTED] wrote: Hi, Is there a way to use a variable in the Prompt parameter like the below line? my $telnet = Net::Telnet-new([HOST = $server,] [PROMPT = /$prompt/,]); Thanks Regards, Lakshmi 952-833-1220

RE: Net::Telnet - Variable in Prompt

2007-06-12 Thread Lakshmi Sailaja
But it did not work. I was getting the below error: timed-out waiting for command prompt at file name line line number Thanks Regards, Lakshmi 952-833-1220 -Original Message- From: Martin Barth [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 2:23 PM To: beginners@perl.org

Re: Net::Telnet - Variable in Prompt

2007-06-12 Thread Chas Owens
On 6/12/07, Lakshmi Sailaja [EMAIL PROTECTED] wrote: But it did not work. I was getting the below error: timed-out waiting for command prompt at file name line line number snip This code works for me. #!/usr/bin/perl use strict; use warnings; use Net::Telnet; #my propmt is

RE: Net::Telnet - Variable in Prompt

2007-06-12 Thread Lakshmi Sailaja
I am if my question was brief. $prompt is a scalar variable. like this: $sub = xyz; $prompt = L:\\$sub; my $t = Net::Telnet-new( Timeout = 10, Prompt = /$prompt/ ); Thanks Regards, Lakshmi 952-833-1220 -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED]

Re: Database insertion, escape issue

2007-06-12 Thread Northstardomus
On Jun 12, 4:59 am, [EMAIL PROTECTED] (Tom Allison) wrote: On Jun 11, 2007, at 7:52 PM, Northstardomus wrote: I have a Perl script where I try to strip some data from a web page and insert it into a database. I'm having a problem where, it seems like the method of quoting the

Re: Database insertion, escape issue

2007-06-12 Thread Northstardomus
On Jun 12, 8:48 am, [EMAIL PROTECTED] (Jenda Krynicky) wrote: From: Mumia W. [EMAIL PROTECTED] On 06/11/2007 06:52 PM, Northstardomus wrote: [...] print br/Inserting into Database , @values.; Use the quotemeta function to escape special characters that may be in the values.

Re: Perl directory listing program

2007-06-12 Thread [EMAIL PROTECTED]
On Jun 12, 5:26 pm, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: Looking for some help here you perl geniuses you : ) I need a program Sorry, I think you are in the wrong place. Here we help people who want to learn Perl. (People who want bespoke ad-hoc programs written for free are generally

Prompt in Net::Telnet

2007-06-12 Thread Lakshmi Sailaja
Hello, I am supposed to write a program that will telnet to a remote server and execute some commands. I get the following error: timed-out waiting for command prompt at file name line line number This is because the prompt is not set correctly. Can you please tell me what the prompt value

Re: Net::Telnet - Variable in Prompt

2007-06-12 Thread Chas Owens
On 6/12/07, Lakshmi Sailaja [EMAIL PROTECTED] wrote: snip $sub = xyz; $prompt = L:\\$sub; my $t = Net::Telnet-new( Timeout = 10, Prompt = /$prompt/ ); snip from perldoc Net::Telnet What To Know Before Using ยท When constructing the match operator argument for

Help creating a random string in Perl

2007-06-12 Thread p46921x
Hello, this is perl.beginners and I am really a beginner. This is also my first Google group post so if I am in the wrong group, I am sorry. I need to create a random combination of n-1 characters in a source string. For example if the string is ABcDeFG (7 characters) * I want to execute my perl

Need help for writing attachment saver

2007-06-12 Thread ash
Hi! I'm trying to write a code to read mail from POP3 server and then save the attachment in specified folder. I checked the Email::MIME::Attachment::Stripper which needs to be initialized with Email::MIME object. I checked the Email::MIME module but I couldn't understand how to read mail and

RE: Help creating a random string in Perl

2007-06-12 Thread Brown, Rodrick
Look at crypt(); $ perldoc -f crypt is a good -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 3:39 PM To: beginners@perl.org Subject: Help creating a random string in Perl Hello, this is perl.beginners and I am really a beginner.

Re: Help creating a random string in Perl

2007-06-12 Thread Chas Owens
On 6/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: snip I can see how to generate a random number between 0 and 6 (meaning I can pick one of the 7 characters in my source string) by using print int(rand(6)), but I don't know where to being on the second and third and fourth characters to

Re: Database insertion, escape issue

2007-06-12 Thread Chas Owens
On 6/12/07, Northstardomus [EMAIL PROTECTED] wrote: snip $dbh-prepare('INSERT INTO area_status (areaID, survey_date, update_time, status ) VALUES (?,?,?,?)'); $dbh-execute('$values[0]', '$values[1]', '$values[2]', '$values[3]'); snip You are getting an error because

Re: Prompt in Net::Telnet

2007-06-12 Thread Chas Owens
On 6/12/07, Lakshmi Sailaja [EMAIL PROTECTED] wrote: Hello, I am supposed to write a program that will telnet to a remote server and execute some commands. I get the following error: timed-out waiting for command prompt at file name line line number This is because the prompt is not set

Re: Prompt in Net::Telnet

2007-06-12 Thread Chas Owens
On 6/12/07, Chas Owens [EMAIL PROTECTED] wrote: snip If you are trying to connect to the telnet server that comes with Microsoft OSes then you are SOL. If you are trying to connect to a different telnet server, then please provide the name of the server and operating system it is running under

Re: Help creating a random string in Perl

2007-06-12 Thread Randal L. Schwartz
p46921x == p46921x [EMAIL PROTECTED] writes: p46921x 1. Only characters in the source string are in the random string p46921x meaning if Z is not in my source string, it will not be in my random p46921x string. If A and B are in the source string, then at least one of them p46921x will be in

Re: Database insertion, escape issue

2007-06-12 Thread Tom Allison
$sth-execute() and read up on DBI a little more. the first page of the perldoc shows a synapsis of all the commands. I frequently have to re-visit these pages to recall what the different functions are. On Jun 12, 2007, at 1:32 PM, Northstardomus wrote: On Jun 12, 4:59 am, [EMAIL