> "JG" == Jim Gibson writes:
JG> At 11:29 AM +0530 9/3/10, Jatin Davey wrote:
>> Any reason to use named variables than to use the default variable ($_) ?
JG> Two reasons that I know:
JG> 1. If you use a named variable, you and everybody else reading your
JG> code will know what i
> "JWK" == John W Krahn writes:
JWK> Uri Guttman wrote:
>>> "JD" == Jatin Davey writes:
>>
>> >> but it isn't as good as my code. don't use $_ unless you have to (as in
>> >> map/grep). it is much better to use named variables.
JD> Any reason to use named variables than to
Uri Guttman wrote:
"JD" == Jatin Davey writes:
>> but it isn't as good as my code. don't use $_ unless you have to (as in
>> map/grep). it is much better to use named variables.
JD> Any reason to use named variables than to use the default variable ($_)
?
yes, you can read the co
At 11:29 AM +0530 9/3/10, Jatin Davey wrote:
Any reason to use named variables than to use the default variable ($_) ?
Two reasons that I know:
1. If you use a named variable, you and everybody else reading your
code will know what it is for. While it doesn't matter much for
3-line loops, s
yes, you can read the code and see what the variable is for. $_ is
useful in some situations but not for foreach loops and similar
things. names are important in code and $_ has no name. you lose the
opportunity to tell the reader of the code what the variable contains
and what it is used for.
> "JD" == Jatin Davey writes:
>> but it isn't as good as my code. don't use $_ unless you have to (as in
>> map/grep). it is much better to use named variables.
JD> Any reason to use named variables than to use the default variable ($_) ?
yes, you can read the code and see what the var
but it isn't as good as my code. don't use $_ unless you have to (as in
map/grep). it is much better to use named variables.
Any reason to use named variables than to use the default variable ($_) ?
and please learn to edit quoted emails and to bottom post. you can google for
what that means.
> "JD" == Jatin Davey writes:
JD> for (keys %months) {
JD> print "Months in $_ : @{$months{$_}} \n";
JD> }
JD> and it worked fine.
but it isn't as good as my code. don't use $_ unless you have to (as in
map/grep). it is much better to use named variables.
JD> On 9/3/2010 10:47
Changed it to:
#!/usr/bin/perl
use warnings;
use strict;
my @english = qw(january february march april may june july);
my @french = qw(janvier fverier mars avril mai juin juily);
my %months;
$months{english} = \...@english;
$months{french} = \...@french;
for (keys %months) {
print "Months in
> "JD" == Jatin Davey writes:
JD> #!/usr/bin/perl
JD> use warnings;
JD> use strict;
very good to see those.
JD> my @english = qw(january february march april may june july);
JD> my @french = qw(janvier fverier mars avril mai juin juily);
JD> my %months;
JD> my $eng_ref;
JD>
Hi
I am a newbie to Perl , I have this piece of code :
*CODE:*
#!/usr/bin/perl
use warnings;
use strict;
my @english = qw(january february march april may june july);
my @french = qw(janvier fverier mars avril mai juin juily);
my %months;
my $eng_ref;
my $fre_ref;
$eng_ref = \...@english;
$
On 9/2/10 Thu Sep 2, 2010 2:00 PM, "Jim"
scribbled:
> On 9/2/2010 4:15 PM, Jim Gibson wrote:
>> My advice is to stay away from these modules unless you know what you are
>> doing. I find that double-precision floating-point arithmetic is always good
>> enough. I have been programming in scient
On Sep 2, 2010, at 3:51 PM, Uri Guttman wrote:
>
> don't use that. use IO::Socket which is higher level and much easier to use.
>
It sure is! Thank you.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On 9/2/2010 4:15 PM, Jim Gibson wrote:
On 9/2/10 Thu Sep 2, 2010 12:52 PM, "Jim"
scribbled:
On 9/2/2010 2:51 PM, Ruud H.G. van Tol wrote:
On 2010-09-02 15:32, Jim wrote:
I was hoping I'd see some answer like... oh yeah... perl is smart enough
to handle that for you if you are willing to ac
On Sep 2, 10:11 am, lel...@claimspages.com ("Lonnie Ellis") wrote:
> You can also turn on the telnet service within Windows rather than using
> SSH. If you want to use SSH, openSSH is a good alternative for Windows,
> but you'll have to install Cygwin on the Windows box. Google it, you
> should f
> "CH" == Chap Harrison writes:
CH> Following the guidelines I found in numerous examples on the web, I wrote
a simple Client-Server app in Perl. However, it appears that the send buffer
does not get flushed until the connection is closed. That's fine for one-way
data transfer, but I ne
Following the guidelines I found in numerous examples on the web, I wrote a
simple Client-Server app in Perl. However, it appears that the send buffer
does not get flushed until the connection is closed. That's fine for one-way
data transfer, but I need the server to be able to receive some req
On 9/2/10 Thu Sep 2, 2010 12:52 PM, "Jim"
scribbled:
> On 9/2/2010 2:51 PM, Ruud H.G. van Tol wrote:
>> On 2010-09-02 15:32, Jim wrote:
>>
>>> I was hoping I'd see some answer like... oh yeah... perl is smart enough
>>> to handle that for you if you are willing to accept a performance hit...
>
On 9/2/2010 2:51 PM, Ruud H.G. van Tol wrote:
On 2010-09-02 15:32, Jim wrote:
I was hoping I'd see some answer like... oh yeah... perl is smart enough
to handle that for you if you are willing to accept a performance hit...
My "bigrat" was meant like that. Did you already try it?
#!/usr/bin/
> "CO" == Chas Owens writes:
CO> You may think there is more code in the while loop version, but really
CO> it there is less. File::Slurp is a pure Perl module. That means that
CO> whatever loop it is using to get the data must happen in Perl. Then
CO> you copy that data to an arra
On Thu, Sep 2, 2010 at 13:08, Uri Guttman wrote:
snip
> for the excluded hash, it is simpler and probably much faster than line
> by line. the latter way needs to run much more perl code which is slower
> than a single slice. i won't benchmark it because it is also better
> coding which is more im
You can also turn on the telnet service within Windows rather than using
SSH. If you want to use SSH, openSSH is a good alternative for Windows,
but you'll have to install Cygwin on the Windows box. Google it, you
should find what you need. Another option would be to install Perl on
the Windows
> "CO" == Chas Owens writes:
CO> On Thu, Sep 2, 2010 at 04:39, Uri Guttman wrote:
CO> snip
>> if you want speed, that is not the best way to read in the file
>> lines. File::Slurp (on cpan) can do that for you and is cleaner as well:
CO> snip
CO> If there was one thing I could c
On 9/2/10 Thu Sep 2, 2010 8:49 AM, "Irfan Sayed"
scribbled:
> Can somebody please give me any pointer
> i am stuck
> I need to write one Perl script which does the following tasks
>
> 1: from linux box , connect to windows box
> 2: run some commands
> 3: copy the output of those commands to
Can somebody please give me any pointer
i am stuck
Regards
Irfan
From: Irfan Sayed
To: beginners@perl.org
Sent: Thu, September 2, 2010 7:09:55 PM
Subject: script to connect windows box from linux
Hi All,
I need to write one Perl script which does the follow
This code(given below) is working fine for all the command but for some
command it is not able to print the output.
I am getting the following output
==
w
52 column window is too narrow
==
Similarly for top it is not printing all the field .
top -cd2
top - 20:36:28
On Thu, Sep 2, 2010 at 10:03, Shawn H Corey wrote:
snip
> See `perldoc perlfaq4` and search for /Does Perl have a round() function?
> What about ceil() and floor()? Trig functions?/
snip
Or just say perldoc -q round, or go to
http://perldoc.perl.org/perlfaq4.html#Does-Perl-have-a-round()-functi
On Thu, Sep 2, 2010 at 09:32, Jim wrote:
snip
> It's really not a question of it being perplexing more so than like I said
> maddening in terms of why solutions just aren't intrinsic to the programming
> language. If ops are slower, so what... throw some more hw at the problem...
> hw is cheap...
On 10-09-02 09:32 AM, Jim wrote:
It's really not a question of it being perplexing more so than like I
said maddening in terms of why solutions just aren't intrinsic to the
programming language. If ops are slower, so what... throw some more hw
at the problem... hw is cheap... people's time isn't.
On 10-09-02 09:32 AM, Jim wrote:
It's really not a question of it being perplexing more so than like I
said maddening in terms of why solutions just aren't intrinsic to the
programming language. If ops are slower, so what... throw some more hw
at the problem... hw is cheap... people's time isn't.
On Thu, Sep 2, 2010 at 04:39, Uri Guttman wrote:
snip
> if you want speed, that is not the best way to read in the file
> lines. File::Slurp (on cpan) can do that for you and is cleaner as well:
snip
If there was one thing I could change about this list, it would be
that to ban people from saying
Hi All,
I need to write one Perl script which does the following tasks
1: from linux box , connect to windows box
2: run some commands
3: copy the output of those commands to linux box
can someone please guide me in how to achieve this using Perl script
any direction / advise would be helpful.
On 9/2/2010 8:53 AM, Paul Johnson wrote:
On Thu, Sep 02, 2010 at 01:11:07AM +0200, Dr.Ruud wrote:
On 2010-09-02 00:49, Paul Johnson wrote:
When you want to compare floating point numbers, check that their
difference is less than some appropriately small delta:
$delta = 1e-8;
if (abs($a - $b)
On Thu, Sep 02, 2010 at 01:11:07AM +0200, Dr.Ruud wrote:
> On 2010-09-02 00:49, Paul Johnson wrote:
>
>> When you want to compare floating point numbers, check that their
>> difference is less than some appropriately small delta:
>>
>> $delta = 1e-8;
>>
>> if (abs($a - $b)< $delta) # numbers are
Hi Stuart,
a few comments on your code.
On Wednesday 01 September 2010 21:18:10 Kryten wrote:
> Wow. Thank you Shlomi, Thank you Chas and Thank you Shawn.
>
> Hash sets seem to be the way to go here. Much quickness too!
>
> Here is what I have ( the least I can do is give you all a chance to
>
> "K" == Kryten writes:
K> Here is what I have ( the least I can do is give you all a chance to
K> laugh
K> at my code! ):-
here comes the laughter! :)
K> #!/usr/bin/perl
K> use warnings ;
put use strict in there too. you are declaring some vars, strict
enforces that you declar
On Jul 20, 6:08 am, mimic...@googlemail.com (Mimi Cafe) wrote:
> I am testingMIME::Lite::TT::HTMLand it works as expected using myhtml
> template. What I need to understand is why it does nit send email using my
> text template or both template, since I did not explicitly specify which
> template t
On 2010-09-01 22:46, Jim wrote:
Can anyone comment how they handle floating point precision situations
like this?
[...]
Note the lack of precision adding these simple numbers which do not have
a large number of digits to the right of the decimal.
If the line:
$total = sprintf("%.2f", $total);
w
On 2010-09-02 00:49, Paul Johnson wrote:
When you want to compare floating point numbers, check that their
difference is less than some appropriately small delta:
$delta = 1e-8;
if (abs($a - $b)< $delta) # numbers are "equal"
Why call it delta when you can call it epsilon?
;)
It also has
Wow. Thank you Shlomi, Thank you Chas and Thank you Shawn.
Hash sets seem to be the way to go here. Much quickness too!
Here is what I have ( the least I can do is give you all a chance to
laugh
at my code! ):-
#!/usr/bin/perl
use warnings ;
my $names_file = 'C:\names.log' ;
my $exclude_list =
40 matches
Mail list logo