Re: Using File::Find module???

2008-03-27 Thread Jeff Pang
On 3/28/08, sanket vaidya <[EMAIL PROTECTED]> wrote: > > Where did this "." come from & how to eliminate it? > '.' means the current directory. to remove it, add a line at the begin of the callback function: return if /^\.+$/; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional command

Using File::Find module???

2008-03-27 Thread sanket vaidya
Hi all I have some files stored in directory "resumes1" (say the files are file1, file2 & file3). When I run the following code use warnings; use strict; use File::Find; find (\&del,"D:/resumes1"); sub del { print "File name is $_\n "; } The output is: File n

Re: how to repeat non-atom patterns

2008-03-27 Thread John W. Krahn
Rob Dixon wrote: ciwei wrote: Given a multiple char patterns like ":C9" that repeated, how to write a regex that repeat the patterns( which is non-atom ) 6 times. like in below WWPN:10:00:00:00:c9:2e:e8:90 I tried to define pattern to match my $match= qr/ {:[0-9a-e][0-9a-e]}{6} /; prin

Re: how to replace @ inside of { }

2008-03-27 Thread Richard Lee
Gunnar Hjalmarsson wrote: Rob Dixon wrote: Richard Lee wrote: Gunnar Hjalmarsson wrote: C:\home>type test.pl use Data::Dumper; my %HoA = ( something => [ qw/val1 val2 val3 and so forth/ ], something2 => [ qw/vala valb valc and so forth/ ], something3 => [ qw/valZ valZ1 valZ2 so f

Re: Handling OLD files

2008-03-27 Thread yitzle
To get the date of a file: perldoc stat http://perldoc.perl.org/functions/stat.html For moving files: http://perldoc.perl.org/perlfaq5.html#How-can-I-reliably-rename-a-file%3f -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: how to repeat non-atom patterns

2008-03-27 Thread Rob Dixon
ciwei wrote: > Given a multiple char patterns like ":C9" that repeated, how to write a regex that repeat the patterns( which is non-atom ) 6 times. like in below WWPN:10:00:00:00:c9:2e:e8:90 I tried to define pattern to match my $match= qr/ {:[0-9a-e][0-9a-e]}{6} /; print matched if /$ma

Handling OLD files

2008-03-27 Thread anders
Hi! I am looking for a way of moving files older than a date, I am need this in a script for moving/erase old files from a production machine Any tips where to read more about this i gratefull, i can't find any, (it is on a Windows server) and i would like to stick to PERL standard package (ActiveS

how to repeat non-atom patterns

2008-03-27 Thread ciwei
Given a multiple char patterns like ":C9" that repeated, how to write a regex that repeat the patterns( which is non-atom ) 6 times. like in below WWPN:10:00:00:00:c9:2e:e8:90 I tried to define pattern to match my $match= qr/ {:[0-9a-e][0-9a-e]}{6} /; print matched if /$match/ ; but it un

Re: What counts as a "void context" in "Don't use grep in a void context"?

2008-03-27 Thread Rob Dixon
Jay Savage wrote: [snip] >> In any case, if someone offered me a way of making my program run in 20ms instead of 25ms I wouldn't be overly impressed, and certainly don't see it as a case of grep 'shining'. I think you missed my point. I may not have been clear. No, shaving a few ms off runtime

Re: What counts as a "void context" in "Don't use grep in a void context"?

2008-03-27 Thread Jay Savage
On Thu, Mar 27, 2008 at 2:22 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Yes I understood your intention, but efficiency isn't everything by any > means. I believe very firmly that programs should be coded in the > clearest and most obvious way possible, then tested and optimised if the > perf

Re: $topIter->next()

2008-03-27 Thread Gunnar Hjalmarsson
Just posted to clpmisc: Original Message Subject: Re: Operator ->() Date: Thu, 27 Mar 2008 20:35:27 +0100 From: Gunnar Hjalmarsson <[EMAIL PROTECTED]> Newsgroups: comp.lang.perl.misc Subra wrote: [ exactly the same question as was posted to the beginners list a few minutes ear

Re: File Handling problem.

2008-03-27 Thread yitzle
Text files don't /have/ "pages". The number of lines per page depends on the printer driver -> the font size, margin size, etc. If you know the number of lines the print driver does per page, you can fill to that point with newlines based on the number of lines already outputted. Or you might be in

Re: question on lexical declaration and submodule

2008-03-27 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: In a large program, I guess there may be many programmers involved and each of these programmers are responsible to write their own sub rountine as required. Henceforth it will be very confusing and problematic if the programmers have to use variables from outside of t

Re: system calls return code

2008-03-27 Thread ultra . star . x
Thank you very much for explaining. I will try what Sandy suggested. I had tested at the command line already just as Jeff did. The confusion came from the fact that I had tried it in csh and in csh, doing the "ls |xargs cat" returned 1. Annoying. C. -- To unsubscribe, e-mail: [EMAIL PROTEC

Re: reference to subroutine???

2008-03-27 Thread Rob Dixon
sanket vaidya wrote: Hi everyone, Kindly go through the code below. use strict; use warnings; sub hello; my $ref = \&hello; &{$ref}; sub hello { print "hello!!"; } The output on perl 5.10 is Hello!! Whereas the output on perl 5.6.1 is Hello!!1 Why two different outputs in two d

Re: What counts as a "void context" in "Don't use grep in a void context"?

2008-03-27 Thread Rob Dixon
Jay Savage wrote: On Wed, Mar 26, 2008 at 9:47 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: Jay Savage wrote: If you want to see grep really shine, though, think about ways you might use it to avoid calling print for every element in the return list, e.g. print join "\n", grep {$_ % 2 == 0} @

Re: Plotting widget in Perl?

2008-03-27 Thread Gowtham M
I tried gtkdatabox. The C language version works fine on my machine, but the perl module doesn't compile :( I get this error: Databox.xs: In function `gtk_databox_data_type_get_type': Databox.xs:75: `GTK_DATABOX_NOT_DISPLAYED' undeclared (first use in this function) Databox.xs:75: (Each undeclar

Copy multiples files to a single file in seperate pages..

2008-03-27 Thread AY
Hi, I'm a beginner with Perl and requires help.. Trying to understand if we have a mechanism to copy multiple files ( txt files ) to a single file (say abc.txt) with each file residing in single page. Each input file is large enough to fit into a single page. I have tried using perl format's like

File Handling problem.

2008-03-27 Thread AY
Hi, Current task requires me to combine a few files into a single file ( abc. txt ) where in each file has to be in a single page. I was able to create a combined file, but not able to ensure that each file resides in a page. Attempted a few things like 'format_lines_left' i.e $-. in vain... One

Re: $topIter->next()

2008-03-27 Thread Jenda Krynicky
From: Subra <[EMAIL PROTECTED]> > Can some one pls tell me wts the meaning of "$topIter->next()" ? > I know "->" is used for hash refs, but dont know when to use ->( ) !!! -> is used for any references. And for method calls. In this case you are calling the next() method of the $topIter object.

Re: What counts as a "void context" in "Don't use grep in a void context"?

2008-03-27 Thread Jenda Krynicky
On Wed, Mar 26, 2008 at 9:47 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > Jay Savage wrote: > > > > If you want to see grep really shine, though, think about ways you > > might use it to avoid calling print for every element in the return > > list, e.g. > > > > print join "\n", grep {$_ % 2

Re: system calls return code

2008-03-27 Thread Sandy
On 27 мар, 03:50, [EMAIL PROTECTED] (Ultra Star X) wrote: > I am really going crazy here. I have the following system call that I > would like to run from perl: > "ls *.txt | xargs cat > out" > if *.txt does not exist then I expect to get an exit code different > from 0. > > So to test I do: > >

$topIter->next()

2008-03-27 Thread Subra
Can some one pls tell me wts the meaning of "$topIter->next()" ? I know "->" is used for hash refs, but dont know when to use ->( ) !!! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: reference to subroutine???

2008-03-27 Thread Lawrence Statton
sanket vaidya wrote: >Whereas the output on perl 5.6.1 is > >Hello!!1 Ummm, beg to differ #!/usr/bin/perl use strict; use warnings; sub hello; my $ref = \&hello; &{$ref}; sub hello { print "hello!!"; } [EMAIL PROTECTED]:~$ perl -l pbml.pl hello!! [EMAIL PROTECTED]:~$ perl -v This is

Re: question on lexical declaration and submodule

2008-03-27 Thread itshardtogetone
- Original Message - From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]> To: 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 lexical (my) and glob

Re: What counts as a "void context" in "Don't use grep in a void context"?

2008-03-27 Thread Jay Savage
On Wed, Mar 26, 2008 at 9:47 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > Jay Savage wrote: > > > > If you want to see grep really shine, though, think about ways you > > might use it to avoid calling print for every element in the return > > list, e.g. > > > > print join "\n", grep {$_ % 2

Re: system calls return code

2008-03-27 Thread Jeff Pang
This is because you send ls's output to a pipe, and the command on the right of the pipe get executed successfully. Try this test on shell: -bash-3.00$ ls |xargs cat ls: : No such file or directory -bash-3.00$ echo $? 0 -bash-3.00$ ls ls: : No such file or directory -bash-3.00$ ec

system calls return code

2008-03-27 Thread ultra . star . x
I am really going crazy here. I have the following system call that I would like to run from perl: "ls *.txt | xargs cat > out" if *.txt does not exist then I expect to get an exit code different from 0. So to test I do: use strict; my $f = "file_which_does_not_exist"; # method 1 print "test

Re: reference to subroutine???

2008-03-27 Thread asmith9983
Hi I copied the code into a script so I could be sure it was the exactly the same source being used on version 5.8.8 and 5.10.0. I'm running an AMD Athlon64 x2 & Ubuntu 7.10 but that is I think irrelevant. For those not familiar with vim line #2 turns off syntax colouring for this file only.Its

Re: question on lexical declaration and submodule

2008-03-27 Thread Robert (bloo)
[EMAIL PROTECTED] wrote: > 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 variabl

Re: How to replace one line in a text file with Perl?

2008-03-27 Thread John W. Krahn
[ Please do not top-post your replies. TIA ] sanket vaidya wrote: Here is the entire code to accomplish your task. It will delete 1st & 3rd lines. use warnings; use strict; my @array; open FH,"data.txt"; You should *always* verify that the file opened correctly: open FH, '<', 'data.txt' o

RE: How to replace one line in a text file with Perl?

2008-03-27 Thread sanket vaidya
Here is the entire code to accomplish your task. It will delete 1st & 3rd lines. use warnings; use strict; my @array; open FH,"data.txt"; @array = ; for my $i (0..$#array) { $array[$i] =~ s/^(\*\/tmp\/dst\/file(1|3)\*(\d){3}\*RW\*(\d){3,4})$/ /; #replace the lines you want to delete with " "

RE: How to replace one line in a text file with Perl?

2008-03-27 Thread sanket vaidya
Here is the entire code to accomplish your task. It will delete 1st & 3rd lines. use warnings; use strict; my @array; open FH,"data.txt"; @array = ; for my $i (0..$#array) { $array[$i] =~ s/^(\*\/tmp\/dst\/file(1|3)\*(\d){3}\*RW\*(\d){3,4})$/ /; #replace the lines you want to delete with " " (sp

Re: Plotting widget in Perl?

2008-03-27 Thread Gowtham M
Zentara, gtkdatabox looks good for me. Can you please mention which perl module in Gtk2::* should I use to use this from perl? Thanks! On Wed, Mar 26, 2008 at 5:23 PM, zentara <[EMAIL PROTECTED]> wrote: > On Wed, 26 Mar 2008 00:22:03 +0530, [EMAIL PROTECTED] ("Gowtham > M") wrote: > > >Thanks fo