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;
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 :
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;
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
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
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
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 =
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
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
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
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
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
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 =
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
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/
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
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
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 =
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
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
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
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:
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:
23 matches
Mail list logo