Re: Redirecting the Output and Error of Perl script

2010-05-01 Thread Philip Potter
On 30 April 2010 18:45, Parag Kalra paragka...@gmail.com wrote: Hey All, I am trying to execute a Perl via shell script. I want to redirect output of Perl script to one file and error occured (if any) to other file. This is the snippet from my shell script: perl output_error.pl 1

testing if divisible by?

2010-05-01 Thread Paul
Hello all. How can I test to see if a number is divisible by say, 40? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: testing if divisible by?

2010-05-01 Thread Shawn H Corey
Paul wrote: Hello all. How can I test to see if a number is divisible by say, 40? Thanks. See `perldoc perlop` and search for /Multiplicative Operators/ Read the part about the % operator. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization

Re: testing if divisible by?

2010-05-01 Thread Philip Potter
On 1 May 2010 12:15, Paul opensou...@unixoses.com wrote: Hello all.  How can I test to see if a number is divisible by say, 40? Thanks. Use the modulo operator %. Given integers $x and $y, the expression $x % $y gives the remainder when $x is divided by $y. As a result, if (and only if) $x is

Re: testing if divisible by?

2010-05-01 Thread Jamie L. Penman-Smithson
On Sat, 2010-05-01 at 07:15 -0400, Paul wrote: Hello all. How can I test to see if a number is divisible by say, 40? Use the modulo operator: my $a = 40; my $b = 1; if ($a % $b == 0) { print $b is divisible by $a\n; } -j -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: testing if divisible by?

2010-05-01 Thread Uri Guttman
JLP == Jamie L Penman-Smithson li...@silverdream.org writes: JLP On Sat, 2010-05-01 at 07:15 -0400, Paul wrote: Hello all. How can I test to see if a number is divisible by say, 40? JLP Use the modulo operator: JLP my $a = 40; JLP my $b = 1; JLP if ($a % $b == 0) { no need for

Re: Redirecting the Output and Error of Perl script

2010-05-01 Thread Parag Kalra
Thanks all... I was printing in normal fashion. I should have used something lik: print STDERR stderr\n; as suggested by all. Cheers, Parag On Sat, May 1, 2010 at 1:55 AM, Philip Potter philip.g.pot...@gmail.comwrote: On 30 April 2010 18:45, Parag Kalra paragka...@gmail.com wrote: Hey

Re: Redirecting the Output and Error of Perl script

2010-05-01 Thread Shawn H Corey
Parag Kalra wrote: Thanks all... I was printing in normal fashion. I should have used something lik: print STDERR stderr\n; as suggested by all. Perhaps you should be using warn and die: warn This appears on STDERR\n; -- Just my 0.0002 million dollars worth, Shawn Programming is

Re: Interactive shell in Perl

2010-05-01 Thread Parag Kalra
I installed psh but getting following error after launching it: Cannot find termcap: TERM not set at C:\perl\lib/Term/ReadLine.pm line 351 Cheers, Parag On Wed, Apr 28, 2010 at 7:45 AM, John W. Krahn jwkr...@shaw.ca wrote: Parag Kalra wrote: Hey All, Hello, Wanted to know if Perl

Re: When to use anonymous references

2010-05-01 Thread Peter Scott
On Wed, 28 Apr 2010 01:16:16 -0400, Uri Guttman wrote: PS == Peter Scott pe...@psdt.com writes: PS On Mon, 26 Apr 2010 22:16:27 +0800, Tim Bowden wrote: I've just realised I almost never use named arrays or hashes anymore. It's almost always anonymous references instead. That