Re: hash usage

2008-02-11 Thread Kashif Salman
Elegant! On Feb 11, 2008 1:35 PM, John W. Krahn [EMAIL PROTECTED] wrote: Johnson, Reginald (GTI) wrote: I have two input files and I put each into a hash. If the key of one hash matches the other then I output some values from both. I have accomplished the output that I want but I want to

Re: Issue

2008-02-11 Thread Gunnar Hjalmarsson
Chas. Owens wrote: If you want to print out only pairs you can use the code below. If you want to print out all of the items in the the longer array, then change the = to = In that case you'd better prevent Perl from spitting out uninitialized warnings... #!/usr/bin/perl use strict; use

Re: Issue

2008-02-11 Thread David Moreno
Apparently, you are rewriting the value of the @alphaid and @betaid arrays on each of the loops after the s///. What are you trying to do with: @alphaid = $line; push(@alphaid,$_); I'd try only: push(@alphaid, $line); if I understood correctly. Cheers, David. On Feb 11, 2008 3:11 PM, [EMAIL

Re: Issue

2008-02-11 Thread Kashif Salman
I am sure there are better ways as I am learning as well, but how about doing something like this. This is assuming both arrays have the same number of elements. open MYFILE, f1.txt; for (0..$#alpha) { print MYFILE $alphaid[$_]\t; print MYFILE $betaid[$_]\n; } On Feb 11, 2008 12:11 PM,

Re: lstat and its uses

2008-02-11 Thread Mark Wagner
On 2/11/08, Michael Barnes [EMAIL PROTECTED] wrote: I thought about using lstat to get the size of a file for file comparisons. I see that lstat always returns a list of thirteen values. The references I find appear to require assignment of those 13 values to variables, even though I only

Re: lstat and its uses

2008-02-11 Thread John W. Krahn
Chas. Owens wrote: On Feb 11, 2008 4:17 PM, Michael Barnes [EMAIL PROTECTED] wrote: I thought about using lstat to get the size of a file for file comparisons. I see that lstat always returns a list of thirteen values. The references I find appear to require assignment of those 13 values to

Re: regarding regular expression

2008-02-11 Thread David Moreno
I'd probably do it as: s/(\..*?)\z//; Cheers, D. On Feb 11, 2008 7:14 AM, [EMAIL PROTECTED] wrote: Hi All, I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is that I want to remove last dot (.) and all the characters/digit after that dot with the help of regular

RE: lstat and its uses

2008-02-11 Thread Wagner, David --- Senior Programmer Analyst --- WGO
-Original Message- From: Chas. Owens [mailto:[EMAIL PROTECTED] Sent: Monday, February 11, 2008 13:21 To: Michael Barnes Cc: beginners@perl.org Subject: Re: lstat and its uses On Feb 11, 2008 4:17 PM, Michael Barnes [EMAIL PROTECTED] wrote: I thought about using lstat to get the

Re: Tokenizing a string

2008-02-11 Thread Dr.Ruud
Martin Barth schreef: Allam Reddy, Thomas: I have a string jdbc/abc.xml which I wanted to tokenize using the delimiter / May I know the perl code for this? you could use split in this situation. @tokens = split(/\//, $string); the frist parameter to split is a regular expression with an

Re: regarding regular expression

2008-02-11 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is that I want to remove last dot (.) and all the characters/digit after that dot with the help of regular expression. If after last dot(.) there are three digit then don't do

Re: regarding regular expression

2008-02-11 Thread John W. Krahn
[EMAIL PROTECTED] wrote: From: John W. Krahn [mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is that I want to remove last dot (.) and all the characters/digit after that dot with the help of regular expression. $

Sys::Gamin install or alternative file system monitor

2008-02-11 Thread Dermot
Hi, I am trying to install Sys::Gamin in a CentOS 5 machine but I am getting a lot of errors at the `make` stage. The errors are from a C file and I am not versed in C :-( There is an initial error from `perl Makefile.PL`: # perl Makefile.PL Ignore Not a known parameter name warnings. Checking

Re: regarding regular expression

2008-02-11 Thread yitzle
To reuse some code... $ perl -le' $_ = D.PRS.WEB.02.10.001.1; print; s/\.[^.]{0,2}\z//; s/\.[^.]{4,}\z//; print; ' Will replace 0 to 2 or more than 3 characters with To get digits and not any character except a dot(.) replace [^.] with [0-9] or the equivalents: \d and [:digits:] -- To

Re: regarding to create a web interface

2008-02-11 Thread Chas. Owens
On Feb 11, 2008 4:18 AM, Rajendra kumar chauhan [EMAIL PROTECTED] wrote: I WANT TO CREATE A WEB INTERFACE FOR A SOFTWARE CALLED BLAT USING CGI AND I HAVE DOWNLAODED AND INSTALLED APACHE WEB BROWSER FOR IT BUT I DONT KNOW HOW TO GO AHEAD,PLEASE ASSIST ME You may find reading the CGI* perldoc

Re: regarding to create a web interface

2008-02-11 Thread Kashif Salman
FYI Caps lock is considered impolite. On Feb 11, 2008 1:18 AM, Rajendra kumar chauhan [EMAIL PROTECTED] wrote: I WANT TO CREATE A WEB INTERFACE FOR A SOFTWARE CALLED BLAT USING CGI AND I HAVE DOWNLAODED AND INSTALLED APACHE WEB BROWSER FOR IT BUT I DONT KNOW HOW TO GO AHEAD,PLEASE ASSIST ME

RE: Tokenizing a string

2008-02-11 Thread Thomas Bätzler
Allam Reddy, Thomas [EMAIL PROTECTED] asked: I have a string jdbc/abc.xml which I wanted to tokenize using the delimiter / May I know the perl code for this? my $string = 'jdbc/abc.xml'; my @tokens = split /\//, $string; print 'Tokens: ' , join( ',', @tokens ), \n; HTH, Thomas -- To

Re: lstat and its uses

2008-02-11 Thread David Moreno
On Feb 11, 2008 4:47 PM, John W. Krahn [EMAIL PROTECTED] wrote: lstat $filename; my $size = -s _; Did you mean: my $size = -s $_; ? -- David Moreno - http://www.damog.net/ Yes, you can.

Re: Tokenizing a string

2008-02-11 Thread David Moreno
But where's the fun then? :) On Feb 11, 2008 4:09 PM, Dr.Ruud [EMAIL PROTECTED] wrote: Or not code a regex at all, and use a module like File::Basename or File::Spec. -- David Moreno - http://www.damog.net/ Yes, you can.

Re: Sys::Gamin install or alternative file system monitor

2008-02-11 Thread David Moreno
You are missing the FAM header files. On some Linux distros, that might be installed as libfam-dev package, not sure on FC4 though. Cheers, David. On Feb 11, 2008 12:17 PM, Dermot [EMAIL PROTECTED] wrote: Hi, I am trying to install Sys::Gamin in a CentOS 5 machine but I am getting a lot of

Issue

2008-02-11 Thread mathkris
Hi, I am learning to print two arrays in a single file but unable to do. So, I am printing it in two files. Any ideas # Populating the arrays @alphaid and @betaid foreach my $line (@File1) { if ($line =~ /^AC/) { $line =~ s/^AC\s*//; @alphaid =

Re: lstat and its uses

2008-02-11 Thread John W. Krahn
Michael Barnes wrote: I thought about using lstat to get the size of a file for file comparisons. I see that lstat always returns a list of thirteen values. The references I find appear to require assignment of those 13 values to variables, even though I only want to use one. Do I really have

Re: hash usage

2008-02-11 Thread John W. Krahn
Johnson, Reginald (GTI) wrote: I have two input files and I put each into a hash. If the key of one hash matches the other then I output some values from both. I have accomplished the output that I want but I want to know if it can be done in a more efficient manner. Yes. #!/usr/bin/perl use

Re: lstat and its uses

2008-02-11 Thread Chas. Owens
On Feb 11, 2008 4:17 PM, Michael Barnes [EMAIL PROTECTED] wrote: I thought about using lstat to get the size of a file for file comparisons. I see that lstat always returns a list of thirteen values. The references I find appear to require assignment of those 13 values to variables, even

Re: Issue

2008-02-11 Thread Chas. Owens
On Feb 11, 2008 3:11 PM, [EMAIL PROTECTED] wrote: Hi, I am learning to print two arrays in a single file but unable to do. So, I am printing it in two files. Any ideas # Populating the arrays @alphaid and @betaid foreach my $line (@File1) { if ($line =~ /^AC/)

Re: lstat and its uses

2008-02-11 Thread Chas. Owens
On Feb 11, 2008 4:39 PM, John W. Krahn [EMAIL PROTECTED] wrote: Chas. Owens wrote: On Feb 11, 2008 4:17 PM, Michael Barnes [EMAIL PROTECTED] wrote: I thought about using lstat to get the size of a file for file comparisons. I see that lstat always returns a list of thirteen values. The

lstat and its uses

2008-02-11 Thread Michael Barnes
I thought about using lstat to get the size of a file for file comparisons. I see that lstat always returns a list of thirteen values. The references I find appear to require assignment of those 13 values to variables, even though I only want to use one. Do I really have to put

hash usage

2008-02-11 Thread Johnson, Reginald (GTI)
I have two input files and I put each into a hash. If the key of one hash matches the other then I output some values from both. I have accomplished the output that I want but I want to know if it can be done in a more efficient manner. #!/usr/bin/perl use strict; use warnings;

Re: lstat and its uses

2008-02-11 Thread David Moreno
That is very interesting, actually. What piece of documentation should I read to learn about this operators? Thanks. David. On Feb 11, 2008 6:14 PM, Kashif Salman [EMAIL PROTECTED] wrote: Perl already has all the info from the previous lstat command, using _ is more efficient in that it

RE: regarding regular expression

2008-02-11 Thread Irfan.Sayed
Thanks John. OOps I did not mentioned one condition while writing the regular expression. condition is : If after last dot(.) there are three digit then don't do anything but if after last dot(.) there are no exactly three digit then replace that dot(.) and all digits after that dot with space.

Re: lstat and its uses

2008-02-11 Thread Kashif Salman
Perl already has all the info from the previous lstat command, using _ is more efficient in that it doesn't have to do another system call. On Feb 11, 2008 2:06 PM, David Moreno [EMAIL PROTECTED] wrote: On Feb 11, 2008 4:47 PM, John W. Krahn [EMAIL PROTECTED] wrote: lstat $filename; my

Re: lstat and its uses

2008-02-11 Thread Gunnar Hjalmarsson
Kashif Salman wrote: On Feb 11, 2008 3:51 PM, Gunnar Hjalmarsson [EMAIL PROTECTED] wrote: [ Please stop this top-posting!! snip -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: lstat and its uses

2008-02-11 Thread Kashif Salman
On Feb 11, 2008 3:51 PM, Gunnar Hjalmarsson [EMAIL PROTECTED] wrote: [ Please stop this top-posting!! And David, you'd better ask your Perl questions of general interest to the list. ] Kashif Salman wrote: David Moreno wrote: Kashif Salman wrote: David Moreno wrote: On Feb 11, 2008

Re: lstat and its uses

2008-02-11 Thread Gunnar Hjalmarsson
[ Please stop this top-posting!! And David, you'd better ask your Perl questions of general interest to the list. ] Kashif Salman wrote: David Moreno wrote: Kashif Salman wrote: David Moreno wrote: On Feb 11, 2008 4:47 PM, John W. Krahn [EMAIL PROTECTED] wrote: lstat $filename; my $size =

RE: lstat and its uses

2008-02-11 Thread Wagner, David --- Senior Programmer Analyst --- WGO
-Original Message- From: Kashif Salman [mailto:[EMAIL PROTECTED] Sent: Monday, February 11, 2008 15:24 To: David Moreno Cc: John W. Krahn; Perl Beginners Subject: Re: lstat and its uses I am not sure how to bring it up using the perldoc, I read it when I was going through the

Re: Tokenizing a string

2008-02-11 Thread Martin Barth
On 12:33:09 11/02/2008 Allam Reddy, Thomas [EMAIL PROTECTED] wrote: Hi All, I have a string jdbc/abc.xml which I wanted to tokenize using the delimiter / May I know the perl code for this? Thanks Thomas Reddy hi, you could use split in this situation. @tokens = split(/\//, $string);

Tk disabling menu entries

2008-02-11 Thread MK
no matter where i use: $menu-entryconfigure(#,disabled); i get: Can't locate object method entryconfigure via package Tk::Menu::Cascade unless i use it on a non-existent $menu, in which case i get: Can't call method entryconfigure on an undefined value Also, if i add a -command in a

Re: Issue

2008-02-11 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi, Hello, I am learning to print two arrays in a single file but unable to do. So, I am printing it in two files. Any ideas Instead of using two arrays just use one Array of Arrays. # Populating the arrays @alphaid and @betaid foreach my $line (@File1)

Re: system (find...) - escape character help

2008-02-11 Thread Pad
I'm pretty sure all sane user and admin tools forbid this, although if you edit /etc/passwd (shadow?) directly, you deserve your BOFH award. :) Thanks everyone for your input and i used successfully chown/chmod in my routines as provided by John Krahn. Yes, it is username and not the uid!!

Tokenizing a string

2008-02-11 Thread Allam Reddy, Thomas
Hi All, I have a string jdbc/abc.xml which I wanted to tokenize using the delimiter / May I know the perl code for this? Thanks Thomas Reddy

Re: regarding regular expression

2008-02-11 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi All, Hello, I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is that I want to remove last dot (.) and all the characters/digit after that dot with the help of regular expression. $ perl -le' $_ = D.PRS.WEB.02.10.001.1; print; s/\.[^.]*\z//;

regarding regular expression

2008-02-11 Thread Irfan.Sayed
Hi All, I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is that I want to remove last dot (.) and all the characters/digit after that dot with the help of regular expression. Please help. Regards Irfan. Project Lead TSINDIA - Production Line Individual Software Solutions

regarding to create a web interface

2008-02-11 Thread Rajendra kumar chauhan
I WANT TO CREATE A WEB INTERFACE FOR A SOFTWARE CALLED BLAT USING CGI AND I HAVE DOWNLAODED AND INSTALLED APACHE WEB BROWSER FOR IT BUT I DONT KNOW HOW TO GO AHEAD,PLEASE ASSIST ME

Re: lstat and its uses

2008-02-11 Thread Kashif Salman
I am not sure how to bring it up using the perldoc, I read it when I was going through the book Learning Perl. Maybe someone else here can point out how to find it in perldoc.. On Feb 11, 2008 3:16 PM, David Moreno [EMAIL PROTECTED] wrote: That is very interesting, actually. What piece of