sort %hash by key

2009-12-07 Thread trapd00r
is how I could sort the hash by it's key value and print out both the keys (sorted) and values (not sorted). My last solution somewhat became a fork bomb and my computer died. :) -- ǁ A: Because it obfuscates the reading. ǁ Q: Why is top posting so bad? trapd00r -- To unsubscribe, e

Feedback, please

2009-12-08 Thread trapd00r
27;s a better way of doing things. Any criticism on anything is highly appreciated, since I want to learn. Cheers. -- ǁ A: Because it obfuscates the reading. ǁ Q: Why is top posting so bad? trapd00r -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands,

Re: Module for determining OS type, OS Version, and Processor Architecture

2010-03-11 Thread trapd00r
On 10/03/10 13:07 -0800, Nik J wrote: I'm searching for a Perl module that will make it easy determine the following: OS Type: windows *unix print $^0; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Module for determining OS type, OS Version, and Processor Architecture

2010-03-11 Thread trapd00r
On 10/03/10 13:07 -0800, Nik J wrote: I'm searching for a Perl module that will make it easy determine the following: OS Type: windows *unix $^O; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Perl Beginners

2010-03-11 Thread trapd00r
On 12/03/10 12:48 +0530, Sudheer K wrote: I am planning to start programming perl for my project . i am just a beginner to perl can i get information related to videos/links and books especially for beginners which can help me writing scripts . http://www.perl.org/learn.html http://www.perl.or

Re: quick question

2010-03-19 Thread trapd00r
On 19/03/10 13:19 +0200, Chris Knipe wrote: my ($foo, $bar) = 1 I am getting more and more occurances where when I use the later as above, $bar would not have a defined value... I'm not quite sure I understand why. Does; my ($foo,$bar) = 1 x 2; do what you want? -- To unsubscribe, e-mail: be

Re: Regex question

2010-03-24 Thread trapd00r
On 24/03/10 00:13 -0700, Bruce Ferrell wrote: if ( ! defined $username || ! $username =~ /[0-9]{10,11}/ ) { do something; } else { do something else; } what that's supposed to do is this: if it's blank or not 10 or 11 digits... The question is where is my understanding faulty or did I mess

Re: script output => color highlight to stdout

2010-05-28 Thread trapd00r
On 27/05/10 22:16 -0500, Bryan Harris wrote: my $e = "\033[0m"; my %cc = ( white => "\033[1;37m", ltgray => "\033[0;37m", gray => "\033[1;30m", black => "\033[0;30m", red => "\033[0;31m", ltred => "\033[1;31m", green => "\033[0;32m", l

Re: Here Docs

2010-06-01 Thread trapd00r
i would say to just use a temporary scalar variable. there is no shame in doing this and it is simpler than using the Interpolation module which is doing tied things and calling eval (which is dangerous). When I dont want to use a temp var, I usually do like this: print << "EOF"; foo @{[scala

Re: Perl file with arguments

2010-06-09 Thread trapd00r
On 09/06/10 13:14 +0530, Gopal Karunakar wrote: How can i declare a simple perl script file which will take arguments from the user? an example will be take two numbers and give the sum as output. use strict; print calc(@ARGV); sub calc { my @to_add = @_; my $i = 0; for my $num(@to_