Plus Plus operator

2011-11-24 Thread samjesse
Hi what does this mean foreach $msg (@subjects) { $subjects{$msg}++; } thx -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Perl for run command on remote machine

2011-11-24 Thread Charith LokuBogahawatta
Hi All, I create following bash script to run some command on remote server and get information but I try to do same using Perl but I couldn't make it so any one can suggest way to get done this using perl ? my .sh... ssh -T $LOGIN EOI cd /x02/oracle/downloads

Re: Plus Plus operator

2011-11-24 Thread Dermot
On 24 November 2011 03:40, samjesse rev...@gmail.com wrote: Hi what does this mean  foreach $msg (@subjects) {     $subjects{$msg}++;  } thx http://perldoc.perl.org/perlop.html#Auto-increment-and-Auto-decrement -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional

Re: Plus Plus operator

2011-11-24 Thread Alexandre Chapoutot
Hello From the element of the array @subjects you create a hash table %subjects and its keys are the element of @subject whose their values are given by an incrementation from an undefined value (defaut consider is 0) so 1. Regards A. 2011/11/24 samjesse rev...@gmail.com: Hi what does this

Re: Perl for run command on remote machine

2011-11-24 Thread Agnello George
On Thu, Nov 24, 2011 at 12:09 PM, Charith LokuBogahawatta charith...@gmail.com wrote: Hi All, I create following bash script to run some command on remote server and get information but I try to do same using Perl but I couldn't make it so any one can suggest way to get done this using perl ?

Re: Plus Plus operator

2011-11-24 Thread timothy adigun
Hi samjesse, using a for loop to iterate the array @subjects and at each instances, count the number of occurrence of each *member* [or element] of the array @subjects, [ and STORE] using a hash %subjects [ which of course is different from the array @subjects, though the same name was used

Re: Perl for run command on remote machine

2011-11-24 Thread Leo Lapworth
On 24 November 2011 10:12, Agnello George agnello.dso...@gmail.com wrote: On Thu, Nov 24, 2011 at 12:09 PM, Charith LokuBogahawatta charith...@gmail.com wrote: Hi All, I create following bash script to run some command on remote server and get information but I try to do same using Perl but

$host = shift || $hostname; vs. $host = $hostname;

2011-11-24 Thread JPH
I found the script below at http://hints.macworld.com/dlfiles/is_tcp_port_listening_pl.txt I am trying to figure out what's happening at lines 20-23. Why is the author using 'shift ||' and not a plain $host = $hostname; Anyone to enlighten me? Thanks! JP --- 1 #!/usr/bin/perl -w 2 #

Re: $host = shift || $hostname; vs. $host = $hostname;

2011-11-24 Thread Rob Coops
On Thu, Nov 24, 2011 at 7:19 PM, JPH jph4dot...@xs4all.nl wrote: I found the script below at http://hints.macworld.com/** dlfiles/is_tcp_port_listening_**pl.txthttp://hints.macworld.com/dlfiles/is_tcp_port_listening_pl.txt I am trying to figure out what's happening at lines 20-23. Why is the

Re: $host = shift || $hostname; vs. $host = $hostname;

2011-11-24 Thread Brandon McCaig
Hello: On Thu, Nov 24, 2011 at 07:42:17PM +0100, Rob Coops wrote: I'm not sure what the meaning is of this but the thing that is happening is simple enough. You have @ARGV which contains [ 'A host name', 'A port number']. On line 20 you set $hostname = $ARGV[0] = 'A host name' and on line 21

Re: $host = shift || $hostname; vs. $host = $hostname;

2011-11-24 Thread Brandon McCaig
Errr,... On Thu, Nov 24, 2011 at 03:05:04PM -0500, Brandon McCaig wrote: use List::Util; use List::Util q/max/; #^^^ my $length = max map { ${#$_} } @arrays; my $length = max map { $#{$_} } @arrays; #^^ FTFM. Regards, -- Brandon McCaig

Re: $host = shift || $hostname; vs. $host = $hostname;

2011-11-24 Thread John W. Krahn
JPH wrote: I found the script below at http://hints.macworld.com/dlfiles/is_tcp_port_listening_pl.txt I am trying to figure out what's happening at lines 20-23. Why is the author using 'shift ||' and not a plain $host = $hostname; Because the author is not a very good Perl programmer? And

Can someone explain references?

2011-11-24 Thread Mike D
Hi all, just started using Perl today, coming over from a background in C#/Java and Python. I seem to be grasping Perl rather nicely (I think) until I got up to references in Beginning Perl. Considering the following code, are all my comments correct? # this function expects an array to be