help in while loop

2008-03-17 Thread Irfan.Sayed
Hi All, Can somebody please let me know the meaning of this line. while ($in) { if(/,/) {print before match: $`\t and after match: $'\n\n;}; $x=$'; $y=$`; mysubroutine($x,$y); } I know it is a while loop for the file handle ($in) and it will be executed till the end of file but

Re: List of hashes

2008-03-17 Thread Krzysztof . Chodak
On 16 Mar, 18:30, [EMAIL PROTECTED] (Yitzle) wrote: On Sun, Mar 16, 2008 at 12:54 PM, John W. Krahn [EMAIL PROTECTED] wrote:   push @records, %record   I think you want an array of references, not of hashed themselves.  Actually, the hash is converted to a list and that list is pushed

Variables initialization

2008-03-17 Thread Krzysztof . Chodak
How is it possible to initialize variable using 0 or '' and not having undef warning later on using them? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Variables initialization

2008-03-17 Thread Xavier Noria
On Mar 17, 2008, at 11:51 , [EMAIL PROTECTED] wrote: How is it possible to initialize variable using 0 or '' and not having undef warning later on using them? Not reassigning to undef. -- fxn -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: help in while loop

2008-03-17 Thread Thomas Bätzler
[EMAIL PROTECTED] asked Can somebody please let me know the meaning of this line. while ($in) { if(/,/) {print before match: $`\t and after match: $'\n\n;}; $x=$'; $y=$`; mysubroutine($x,$y); } The loop iterates over a filehandle, setting $_ to each line in turn. If that line

Re: Variables initialization

2008-03-17 Thread Chas. Owens
On Mon, Mar 17, 2008 at 6:51 AM, [EMAIL PROTECTED] wrote: How is it possible to initialize variable using 0 or '' and not having undef warning later on using them? snip Well, you can say my $var = 0; but that doesn't prevent the variable from being set to undef later, so if it is possible

xml::twig help

2008-03-17 Thread Ken Foskey
I am extracting addresses from an XML file to process through other programs using pipe delimiter the following code works but this is going to get 130,000 records through it it must be very efficient and I cannot follow the documentation on the best way to do this. After this simple one is

Re: help in while loop

2008-03-17 Thread Telemachus
On Mar 17, 7:40 am, [EMAIL PROTECTED] (Irfan Sayed) wrote: Hi All, Can somebody please let me know the meaning of this line. while ($in) { if(/,/) {print before match: $`\t and after match: $'\n\n;}; $x=$'; $y=$`; mysubroutine($x,$y); } I know it is a while loop for the file handle

Re: List of hashes

2008-03-17 Thread yitzle
On Mon, Mar 17, 2008 at 7:12 AM, [EMAIL PROTECTED] wrote: Are subs always return references or only for anonymous lists/hashes? perldoc perlsub The Perl model for function call and return values is simple: all functions are passed as parameters one single flat list of scalars, and all

Re: help in while loop

2008-03-17 Thread telemachus07
On Mar 17, 7:40 am, [EMAIL PROTECTED] (Irfan Sayed) wrote: Hi All, Can somebody please let me know the meaning of this line. while ($in) { if(/,/) {print before match: $`\t and after match: $'\n\n;}; $x=$'; $y=$`; mysubroutine($x,$y); } I know it is a while loop for the file handle

diff of two files

2008-03-17 Thread Irfan.Sayed
Hi All, I want to compare the two files in Perl. The requirement is that file 1 has 20 lines and file2 has 25 lines . I want to see only five lines as output which are there in file2 not in file1 as I know that rest of the 20 lines are same in both the files. I am using the following commands

Re: functions: rotate and factorial

2008-03-17 Thread Sharan Basappa
Rob, Actually you are correct. I was on my way to implement permutation for a given set of numbers. In that context, I had designed my own algo as a part of bigger problem I am trying to solve. That algo requires rotate and factorial. Rotate to get different combinations and factorial to limit

Re: functions: rotate and factorial

2008-03-17 Thread Chas. Owens
On Mon, Mar 17, 2008 at 10:34 AM, Sharan Basappa [EMAIL PROTECTED] wrote: Rob, Actually you are correct. I was on my way to implement permutation for a given set of numbers. In that context, I had designed my own algo as a part of bigger problem I am trying to solve. That algo requires

RE: Variables initialization

2008-03-17 Thread Thomas Bätzler
[EMAIL PROTECTED] asked; How is it possible to initialize variable using 0 or '' and not having undef warning later on using them? my $variable = 0; # = initial value goes here HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: help in while loop

2008-03-17 Thread Thomas Bätzler
[EMAIL PROTECTED] asked: I have certain doubts. What's the meaning of if mysubroutine was defined with prototypes and you were trying to disable that sentence. Could you please elaborate that what's the meaning of this??? When declaring a subroutine, you can optionally also declare a

Re: xml::twig help

2008-03-17 Thread Rob Dixon
Ken Foskey wrote: I am extracting addresses from an XML file to process through other programs using pipe delimiter the following code works but this is going to get 130,000 records through it it must be very efficient and I cannot follow the documentation on the best way to do this. After this

Re: Hash CSV

2008-03-17 Thread JBallinger
On Mar 14, 3:26 pm, [EMAIL PROTECTED] (Manoj) wrote: When using Data: Dumper is taking more time for my 1 lines of CSV file. This solved a few queries...and the benchmark was a new value addition for me. Thanks 2)       Is there any optimal method for reading a CSV file and put to hash

perl warnings

2008-03-17 Thread Kashif Salman
Hello, I have a CGI script; when it runs the very first time I define some variables my $action = $q-param('action'); The first time it runs, parameter 'action' isn't defined so that is how I check that it is running the first time and do my things if ($aciton eq ) {...} elsif ($action eq

Re: diff of two files

2008-03-17 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I want to compare the two files in Perl. The requirement is that file 1 has 20 lines and file2 has 25 lines . I want to see only five lines as output which are there in file2 not in file1 as I know that rest of the 20 lines are same in both the files. I am using the

Re: perl warnings

2008-03-17 Thread yitzle
I think you want: if( defined $q-param('action') ) { } else { } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: perl warnings

2008-03-17 Thread Gunnar Hjalmarsson
Kashif Salman wrote: I have a CGI script; when it runs the very first time I define some variables my $action = $q-param('action'); The first time it runs, parameter 'action' isn't defined so that is how I check that it is running the first time and do my things if ($aciton eq ) {...} elsif

Re: perl warnings

2008-03-17 Thread Kashif Salman
On Mon, Mar 17, 2008 at 11:46 AM, Gunnar Hjalmarsson [EMAIL PROTECTED] wrote: Kashif Salman wrote: I have a CGI script; when it runs the very first time I define some variables my $action = $q-param('action'); The first time it runs, parameter 'action' isn't defined so that is

Re: perl warnings

2008-03-17 Thread John W. Krahn
Kashif Salman wrote: Hello, Hello, I have a CGI script; when it runs the very first time I define some variables my $action = $q-param('action'); The first time it runs, parameter 'action' isn't defined so that is how I check that it is running the first time and do my things if ($aciton

Client-Server Architecture script

2008-03-17 Thread Anirban Adhikary
Dear List I want to write a script using TCP protocol where will be a single server which can handle multiple client request simultaneously. I am able to write a script using IO::Socket but In these scripts my server can handle single client suppose my server is printing the IP address of the

Re: perl warnings

2008-03-17 Thread Paul Lalli
On Mar 17, 2:08 pm, [EMAIL PROTECTED] (Kashif Salman) wrote: Hello, I have a CGI script; when it runs the very first time I define some variables my $action = $q-param('action'); The first time it runs, parameter 'action' isn't defined so that is how I check that it is running the first time

Re: perl warnings

2008-03-17 Thread Paul Lalli
On Mar 17, 2:46 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: Kashif Salman wrote: I have a CGI script; when it runs the very first time I define some variables my $action = $q-param('action'); The first time it runs, parameter 'action' isn't defined so that is how I check that it

Re: perl warnings

2008-03-17 Thread Kashif Salman
On Mon, Mar 17, 2008 at 12:04 PM, Paul Lalli [EMAIL PROTECTED] wrote: On Mar 17, 2:46 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: Kashif Salman wrote: I have a CGI script; when it runs the very first time I define some variables my $action = $q-param('action'); The first

Re: xml::twig help

2008-03-17 Thread Jay Savage
On Mon, Mar 17, 2008 at 9:55 AM, Ken Foskey [EMAIL PROTECTED] wrote: I am extracting addresses from an XML file to process through other programs using pipe delimiter the following code works but this is going to get 130,000 records through it it must be very efficient and I cannot follow

flock - exclusive file locking

2008-03-17 Thread Dermot
Hi, I have a cgi script that writes to a disk file. It would be safest if I can get an exclusive lock on the file. I had a look at the opentut and believe I have followed that the example there. Here's what I have sysopen my $fh, $file_path, O_WRONLY || die can't open $file_path:

Re: flock - exclusive file locking

2008-03-17 Thread Dr.Ruud
Dermot schreef: sysopen my $fh, $file_path, O_WRONLY || die can't open $file_path: $!\n; Change or-operator (or use parenthesis). -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: flock - exclusive file locking

2008-03-17 Thread Gunnar Hjalmarsson
Dermot wrote: I have a cgi script that writes to a disk file. It would be safest if I can get an exclusive lock on the file. I had a look at the opentut and believe I have followed that the example there. Here's what I have sysopen my $fh, $file_path, O_WRONLY || die can't open

Re: xml::twig help

2008-03-17 Thread Jenda Krynicky
From: Ken Foskey [EMAIL PROTECTED] I am extracting addresses from an XML file to process through other programs using pipe delimiter the following code works but this is going to get 130,000 records through it it must be very efficient and I cannot follow the documentation on the best way to

Re: perl warnings

2008-03-17 Thread Gunnar Hjalmarsson
Paul Lalli wrote: On Mar 17, 2:46 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: if ( ! $action ) {...} That'll work great until some jackass puts ?action=0 in the URL. So what? If you put random crap in the URL, you can't reasonably expect a meaningful response. In this case,

Re: flock - exclusive file locking

2008-03-17 Thread John W. Krahn
Dermot wrote: Hi, Hello, I have a cgi script that writes to a disk file. It would be safest if I can get an exclusive lock on the file. I had a look at the opentut and believe I have followed that the example there. Here's what I have sysopen my $fh, $file_path, O_WRONLY || die can't open

FW: How to install Date::Manip on cygwin perl?

2008-03-17 Thread Siegfried Heintze (Aditi)
Hmm... I did not see this appear on the list so I'm posting it again. I'm using cygwin perl on windows and as you can see below, cpan seems to choking on the path name /cygdrive/c/Documents and settings/a-siehei/My Documents because of the spaces. Surely someone else has a workaround! My

Re: perl warnings

2008-03-17 Thread Justin Hawkins
On 17 Mar 2008, at 21:58, Gunnar Hjalmarsson wrote: In this case, if I understand it correctly, the default version of the page, with a form, would appear. Why would that be a problem for anybody but the stupid user? ;-) Fundamentally, don't make it possible for your users to do anything

RE: How to install Date::Manip on cygwin perl?

2008-03-17 Thread Mike Wohlrab
Greetings, I am not familiar at all with Perl, but from my experiences with MS-DOS, if you want to have the CLI read something, IE file name or path, then you need to enclose the filename and path in quotes. So if you could try to enclose the path in quotes, that may work. Regards, Mike Wohlrab

Re: while reading 'mastering perl' @+ and @-, not too clear on this

2008-03-17 Thread Richard Lee
Say you have the string abcdefghi. The positions in the string are: a b c d e f g h i ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 0 1 2 3 4 5 6 7 8 9 If you have the regular expression: /(de)/ Then the match starts at position 3, moves forward two characters, and ends at position 5, where the next match, if

\Q on an pattern containing double quotes, braces etc.

2008-03-17 Thread R (Chandra) Chandrasekhar
Dear Folks, I want to comment out certain lines in a file that match a particular pattern. The file contains lines with characters like: {, }, ==, and . Specifically, I want to replace lines beginning with ATTRS{idVendor}==07b4, ATTRS{idProduct}==0109, with # ATTRS{idVendor}==07b4,

Re: \Q on an pattern containing double quotes, braces etc.

2008-03-17 Thread John W. Krahn
R (Chandra) Chandrasekhar wrote: Dear Folks, Hello, I want to comment out certain lines in a file that match a particular pattern. The file contains lines with characters like: {, }, ==, and . '{' is only special in a regular expression if it is immediately followed by a numerical digit,