|
|
Up |
|
|
  |
Author: Jeff PangJeff Pang
Date: Jan 22, 2008 19:55
-----Original Message-----
>From: Jenda Krynicky
>Sent: Jan 23, 2008 12:59 AM
>To: beginners-list perl.org>
>Subject: Re: about the dot
>
>From: Jeff Pang earthlink.net>
>> I'm a little confused by perl's dot operator.for example,
>>
>> $ perl -le 'print 3 . 4 '
>> 34
>> $ perl -le 'print 3.4 '
>> 3.4
>>
>> these two commands got different results.
>>
>> who says Perl interpreter will ignore the blackspace around an operator? I saw it doesn't here.
>> Ok you may say 3.4 is a float not a statement with '.' operation, but this case really make people confused.
>
>As far as I can tell you are the first to get confused. ...
|
| Show full article (1.84Kb) |
|
| |
2 Comments |
|
  |
Author: Vahid MoghaddasiVahid Moghaddasi
Date: Jan 22, 2008 17:49
Hi,
I have a very strange problem (to me anyways). I have the following
subroutine to sort unique a UNIX password file based on UID and
username. But the problem is that some of the users get disappeared
the output password file. I couldn't figure out the pattern of user
disappearance but always the same few users are filtering.
Can someone please take a look at my code and tell me why is it
messing with me? Any suggestion to rewrite it is also welcome. Thank
you all.
sub Sort {
my ($infile,$outfile) = @_;
my @unique = ();
my %%seen = ();
open my $tmp_out, '>', "$outfile"
or die "could not write the sorted list: $!";
open my $tmp_in, '<', "$infile"
or die "could not open $infile to sort: $!";
|
| Show full article (1.24Kb) |
|
| |
10 Comments |
|
  |
Author: Bootleg86 Bootleg86Bootleg86 Bootleg86
Date: Jan 22, 2008 17:45
Hi,
I came across this construct
foreach $i ( @{$y} ) {
#do something
}
Is @ referring to some default array that doesn't need to be declared?
Also it's using the associative version of an array?
I always thought only hashes were associative.
Thanks
|
| |
|
15 Comments |
|
  |
Author: juleigha27juleigha27
Date: Jan 22, 2008 13:31
Hi,
Hopefully this appropriate question for this group. I am trying to
redirect to a website:
print $query->redirect(-location=>test.cgi?ID=$value", -
method=>'GET');
Unfortunately the $value never gets passed and I end up with test.cgi?
ID= .
Thanks,
J
|
| |
|
10 Comments |
|
  |
Author: LerameurLerameur
Date: Jan 22, 2008 11:58
Hello,
I wrote a short perl script (65 lines), simply to count some log file
time, and take the average. The script takes 4 minutes to run and go
through about 8 millions lines.
I would like to know if I can make it run faster. Why?, if I use the
command 'wc -l filename' , I get the number of lines in about a
minute, that is three less then the small script. I am right by
thinking the script can be reprogrammed so it can be process the file
faster ???
thanks
Ken
|
| |
|
6 Comments |
|
  |
Author: Jonathan MastJonathan Mast
Date: Jan 22, 2008 07:42
I have a perl module that extensively uses a variable named "$main", which
is apparently bound to the script that calls the library.
I can't find where the exact semantics of this automagic variable defined.
thanks,
jhmast
|
| |
|
6 Comments |
|
  |
Author: Jeff PangJeff Pang
Date: Jan 22, 2008 01:01
-----Original Message-----
>From: "Zhao, Bingfeng" ca.com>
>Sent: Jan 22, 2008 4:53 PM
>To: beginners@perl.org
>Subject: list or hash of replacement regex
>
>But perl complains, so I update it as:
>my %%policies = (
> qr/abc/ => "def",
> qr/jfk\s+/ => "jfk ",
> qr/\d+uu/ => "uu\1"
>);
For a first look, you may reversed the hash's keys and values.
Constructing it as below is better.
%%policies = (
'def' => qr/abc/,
'jfk' => qr/jfk\s+/,
...);
|
| Show full article (0.50Kb) |
|
1 Comment |
|
  |
|
|
  |
Author: Bingfeng ZhaoBingfeng Zhao
Date: Jan 22, 2008 00:53
Hi list,
I'm in trouble and hope who can work me out.
I want to so some replacements, so I want to keep all replacement
policies in a hash so that I can use them in a foreach loop, such as:
my %%policies = (
"abc" => "def",
"jfk\s+" => "jfk ",
"(\d+)uu" => "uu\1"
#... many policies here
);
foreach ()
{
s/$_/$policies{$_}/g for keys %%policies;
print;
}
|
| Show full article (1.25Kb) |
|
2 Comments |
|
|
|
|