Time stamp in file name.

2009-07-08 Thread Meghanand Acharekar
Hi, I am writing a perl script which creates a file (on Linux/UNIX) using system's date. e.g. log_2009-07-07.gz Here is the code I wrote. #!/usr/bin/perl -w # Prog for demostrating file name concatenations. $prefix=log; $suffix=.gz;

Re: Time stamp in file name.

2009-07-08 Thread Alexander Koenig
Hi, You wrote on 07/08/2009 09:35 AM: #!/usr/bin/perl -w # Prog for demostrating file name concatenations. $prefix=log; $suffix=.gz; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); # Time $middle=sprintf %4d-%02d-%02d \n,$year+1900,$mon+1,$mday; print My Date :

AW: Time stamp in file name.

2009-07-08 Thread Thomas Bätzler
Meghanand Acharekar vasco.deb...@gmail.com asked: I am writing a perl script which creates a file (on Linux/UNIX) using system's date. e.g. log_2009-07-07.gz Here is the code I wrote. #!/usr/bin/perl -w use strict; # Prog for demostrating file name concatenations. $prefix=log;

Re: Time stamp in file name.

2009-07-08 Thread Alexander Koenig
I wrote on 07/08/2009 09:50 AM: #!/usr/bin/perl -w # Prog for demostrating file name concatenations. $prefix=log; $suffix=.gz; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); # Time $middle=sprintf %4d-%02d-%02d \n,$year+1900,$mon+1,$mday; print My Date : $middle

Re: Time stamp in file name.

2009-07-08 Thread Meghanand Acharekar
Hi, Thanx for helpIt was a silly mistake, I put a '\n' due to usual practice , The prob is resolved, by not using join. Now $middle=sprintf %4d-%02d-%02d,$year+1900,$mon+1,$mday; and $file_name=$prefix._.$middle.$suffix; But still a bit curios about this if I do $middle=`date +%F`; I get

Re: Time stamp in file name.

2009-07-08 Thread Alexander Koenig
Hi again, You wrote on 07/08/2009 10:14 AM: But still a bit curios about this if I do $middle=`date +%F`; I get result ( the new line prob), New File name : log_2009-07-07 .gz It there any way to do it using this (Using date command). That's because the date output includes a

Re: Time stamp in file name.

2009-07-08 Thread John W. Krahn
Meghanand Acharekar wrote: Hi, Hello, Thanx for helpIt was a silly mistake, I put a '\n' due to usual practice , The prob is resolved, by not using join. Now $middle=sprintf %4d-%02d-%02d,$year+1900,$mon+1,$mday; and $file_name=$prefix._.$middle.$suffix; Or just: my $file_name =

Re: Time stamp in file name.

2009-07-08 Thread Meghanand Acharekar
2009/7/8 Alexander Koenig alexander.koe...@mpi.nl Hi again, You wrote on 07/08/2009 10:14 AM: But still a bit curios about this if I do $middle=`date +%F`; I get result ( the new line prob), New File name : log_2009-07-07 .gz It there any way to do it using this (Using date

Help needed with '-e' operator

2009-07-08 Thread Anu P
Hi, I am trying to use the '-e' filetest operator and encountered some wired behavior. I have a tar.gz file which is around 2.6 G and this is the code...Tar.gz file is in the same directory where script is executed. unless (-e $file) { print (ERROR: $file does not exist\n); exit(1); } This

Debugging and tests

2009-07-08 Thread Steve Bertrand
Hi everyone, I've got a couple of simple questions. First, I know that the below line is not correct, but instead of having someone correct it, I'd rather learn more about the Perl debugger, and the map function. I'd like to replace 'h_' with 'hello_' in each key name in %hash, but warnings

Re: Debugging and tests

2009-07-08 Thread Steve Bertrand
Steve Bertrand wrote: Hi everyone, I've got a couple of simple questions. First, I know that the below line is not correct, but instead of having someone correct it, I'd rather learn more about the Perl debugger, and the map function. I'd like to replace 'h_' with 'hello_' in each key

Re: File::Find with chmod trouble debugging

2009-07-08 Thread Harry Putnam
Telemachus telemac...@arpinum.org writes: On Mon Jul 06 2009 @ 3:31, Harry Putnam wrote: Thanks to all ... Now I'm curious about something else: Is the mode in a stat(file) readout something still different than octal or decimal? As John answered, there's more there than just the

Re: Debugging and tests

2009-07-08 Thread Chas. Owens
On Wed, Jul 8, 2009 at 09:31, Steve Bertrandst...@ibctech.ca wrote: snip my %newhash = map { $_ =~ s/h_/hello_/; ($_, $hash{$_}) } keys %hash; snip That will still have a problem: $_ is changed, so it won't reference the correct thing in %hash. Try this instead: my %newhash = map { (my $k =

Re: Debugging and tests

2009-07-08 Thread Steve Bertrand
Chas. Owens wrote: On Wed, Jul 8, 2009 at 09:31, Steve Bertrandst...@ibctech.ca wrote: snip my %newhash = map { $_ =~ s/h_/hello_/; ($_, $hash{$_}) } keys %hash; snip That will still have a problem: $_ is changed, so it won't reference the correct thing in %hash. Try this instead: my

Perl on VxWorks

2009-07-08 Thread Jenn G.
Hello, Sorry I'm just asking this question for others. Does anyone have the experience of porting Perl on VxWorks OS? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Debugging and tests

2009-07-08 Thread Chas. Owens
On Wed, Jul 8, 2009 at 10:16, Steve Bertrandst...@ibctech.ca wrote: snip I agree, and just before you mailed, I did figure out that I needed a placeholder, by using your recommended 'w' command in the debugger. It's a tiny bit different than your approach, but it works ;) %hash = map { my $x

Sorting a hash to user needs

2009-07-08 Thread Alexander Müller
Hi, I need an order for hash by user preferences. Because the criterion to order the hash entries a not numerical and not should sorted alphabetical, I tried following   3 %hashToSort = (   4 a = one,   5 b = two,   6 c = three,   7 ); @keys = sort { qw(a, b, c) } (keys

Re: Sorting a hash to user needs

2009-07-08 Thread Chas. Owens
On Wed, Jul 8, 2009 at 15:09, Alexander Mülleralexan.muel...@fh-wolfenbuettel.de wrote: Hi, I need an order for hash by user preferences. Because the criterion to order the hash entries a not numerical and not should sorted alphabetical, I tried following   3 %hashToSort = (   4 a =

Re: Help needed with '-e' operator

2009-07-08 Thread Robert Citek
The code you wrote should work as it worked for me when I tested it on a 3 GB sized file: $ ls -sh 3gb-file 3.0G 3gb-file $ perl -le '$file=3gb-file ; unless (-e $file) { print (nope) ; } else { print (yup) ; } ' yup I tested it with files as large as 10 GB and it worked. Could it be that the

Re: Help needed with '-e' operator

2009-07-08 Thread John Refior
On Wed, Jul 8, 2009 at 7:34 AM, Anu P anurao_...@yahoo.com wrote: I am trying to use the '-e' filetest operator and encountered some wired behavior. I have a tar.gz file which is around 2.6 G and this is the code...Tar.gz file is in the same directory where script is executed. unless (-e

Re: Debugging and tests

2009-07-08 Thread Steve Bertrand
On Wed, Jul 8, 2009 at 10:16, Steve Bertrandst...@ibctech.ca wrote: %hash = map { my $x = $_; $_ =~ s/h_/hello_/;$_, $hash{$x} } keys %hash; snip The following bits of advice are stylistic in nature, so you can ignore them, but there really are good reasons not to. As name, $x does not

Is there a well-written threading TCP server module for perl?

2009-07-08 Thread XUFENG
hi all, Is there a well-written threading TCP server module for perl? I want a module that manages threading itself and utilize Posix Threading for performance. -- XUFENG 2009-07-09 -- To unsubscribe, e-mail:

Re: Is there a well-written threading TCP server module for perl?

2009-07-08 Thread Jenn G.
On Thu, Jul 9, 2009 at 11:38 AM, XUFENGxufeng...@sina.com wrote: hi all,        Is there a well-written threading TCP server module for perl? I want a module that manages threading itself and utilize Posix Threading for performance. See this class Socket::Class: