in reply to 2 newby questions
Welcome Socrates440,
As a 'newby' you may not be aware of the great command line tool that Perl is. For one liners, I use $h (hash), $ar (array), $s (scalar). For now, just avoid using $a and $b, as these are used by sort. So you could have tested your question immediately from the command line as:
or if you have a Perl of version 5.10 or later you could use '-E' with 'say'.perl -e ' $h{W}=2; $h{W}++; print "$h{W}\n";' Result: 3
Obviously, you could have typed 'use strict' as you should in your scripts, but this is a throw away one-liner, so why type more.
It's a fast way to test your question. In the beginning I never used this great capability, but now I keep a xterm open just for this purpose.
Good Luck
"Well done is better than well said." - Benjamin Franklin
|
|---|