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";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=local
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;
> pri
Meghanand Acharekar 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";
> $suffix=".gz";
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;
>> pr
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 = sp
2009/7/8 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 co
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 d
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 indic
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 k
Telemachus 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 permissions. If
On Wed, Jul 8, 2009 at 09:31, Steve Bertrand 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 = $_) =~ s/h_/hello_
Chas. Owens wrote:
> On Wed, Jul 8, 2009 at 09:31, Steve Bertrand 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
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 Bertrand 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) } (
On Wed, Jul 8, 2009 at 15:09, "Alexander
Müller" 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" => "one",
> 5 "b"
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
On Wed, Jul 8, 2009 at 7:34 AM, Anu P 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 $file) {
> print
> On Wed, Jul 8, 2009 at 10:16, Steve Bertrand 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 really mea
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: beginners-unsubscr...@
On Thu, Jul 9, 2009 at 11:38 AM, XUFENG 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":
http://search.cpan.org/~chrmue/Socket
23 matches
Mail list logo