Re: function call

2008-12-30 Thread John W. Krahn
David Ehresmann wrote: List, Hello, I have a factorial script that calls a sub fact that does the factorial and returns a value. But I get this error when I execute the script: Use of uninitialized value in numeric gt (>) at fact.pl line 22. Here is the script: #!/usr/bin/perl use warnin

Re: function call

2008-12-30 Thread Chas. Owens
On Tue, Dec 30, 2008 at 10:08, David Ehresmann wrote: > this works, thanks. I thought you had to declare the function before > you called it? That is not right? snip No, but there are some benefits to doing so. For instance, if you don't use parenthesis with calls to functions perl hasn't seen

Re: function call

2008-12-30 Thread Mr. Shawn H. Corey
On Tue, 2008-12-30 at 09:08 -0600, David Ehresmann wrote: > this works, thanks. I thought you had to declare the function before > you called it? That is not right? No, when you execute a Perl script, it is compiled before it is run. Therefore all subs are known before the script is run; they are

Re: function call

2008-12-30 Thread Jenda Krynicky
From: "Mr. Shawn H. Corey" > On Tue, 2008-12-30 at 07:10 -0600, David Ehresmann wrote: > > fact(); > > This calls the sub with an undef arguement. Just delete this line. No. It calls the sub with no arguments. fact(undef); would call it with an undef argument. > > my $num; > > > > print "e

Re: function call

2008-12-30 Thread David Ehresmann
this works, thanks. I thought you had to declare the function before you called it? That is not right? #!/usr/bin/perl use warnings; use strict; my $num; print "enter a number: \n"; chomp($num = ); my $x = fact($num); print "the factorial is: $x\n"; sub fact { my $num = shift @_;

Re: function call

2008-12-30 Thread Mr. Shawn H. Corey
On Tue, 2008-12-30 at 07:10 -0600, David Ehresmann wrote: > I have a factorial script that calls a sub fact that does the > factorial and returns a value. But I get this error when I execute > the script: > > Use of uninitialized value in numeric gt (>) at fact.pl line 22. > > Here is the script

Re: function call help

2008-07-09 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > > I facing one issue in Perl script. I am executing one command in Perl > script and taking the output of that command in one array. Now I want > to execute some more commands on each value of the array. > > But the problem is that I am passing each value of the arra

RE: function call help

2008-07-09 Thread Irfan.Sayed
tewart Anderson [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2008 7:45 PM To: Sayed, Irfan; beginners@perl.org Cc: Stewart Anderson Subject: RE: function call help Lock is a perl function http://perldoc.perl.org/functions/lock.html #! /usr/bin/perl # Perl script to ta

RE: function call help

2008-07-09 Thread Stewart Anderson
Lock is a perl function http://perldoc.perl.org/functions/lock.html #! /usr/bin/perl # Perl script to take the backup of critical clearcase data @vob_lst=(qw(test test1 test2)); foreach $a (@vob_lst) { lockvob($a); } sub lockvob { local ( $loc

Re: Function call problem

2006-04-19 Thread John W. Krahn
Nath, Alok (STSD) wrote: > Hi all, Hello, > Can anybody help me to figure out why the first function call > works but the second one is unable to do it. > > Only difference is I am using DownloadFolder variable to send > the value. > > > #FtpVM('test.americas.corp.net', > '/1.00/