Re: Undefined subroutine Error

2005-05-09 Thread Wiggins d'Anconia
is this: Undefined subroutine main::some_routine_name called at script_name line XXX TIA If they are miscodings then not really, mostly because Perl allows you to choose subroutines/methods at runtime. So the interpreter can't know a pri ori what subs need to exist. If you need to check for a sub

Undefined subroutine Error

2005-05-07 Thread Mike Blezien
Hello, occasionally we get this error, due to a mis coding error or type-O error, but was wondering is there away to check, with a perl code, to make sure the sub routine exists before displaying this system 500 internal error message. the error I'm referring too is this: Undefined subroutine

Calling a subroutine - strict very strict

2005-05-06 Thread Tielman Koekemoer \(TNE\)
Hi All, I apologise for the newbie question straight off - I don't have my Camel book with me to consult. Why does the following give me an error?: -- #!/usr/bin/perl -w # # A script that gets a list of technologies that have events on Display layer. # use strict; sub q_db

Re: Calling a subroutine - strict very strict

2005-05-06 Thread Prasanna Kothari
what is param.? If it's a variable, and not declared, qualify it using my or local. Else, if it's a string that you want pass to the function, use single quotes. -Prasanna Tielman Koekemoer (TNE) wrote: Hi All, I apologise for the newbie question straight off - I don't have my Camel book with me

RE: Calling a subroutine - strict very strict

2005-05-06 Thread Tielman Koekemoer \(TNE\)
Thanks Prasanna, that fixed it. -Original Message- From: Prasanna Kothari [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 02:26 PM To: beginners@perl.org Cc: Tielman Koekemoer (TNE) Subject: Re: Calling a subroutine - strict very strict what is param.? If it's a variable, and not declared

RE: Calling a subroutine - strict very strict

2005-05-06 Thread Tielman Koekemoer \(TNE\)
Maybe I should tell you what fixed it: The param was a string so enclosed it in single quotes. Thanks! -Original Message- From: Tielman Koekemoer (TNE) [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 02:33 PM To: [EMAIL PROTECTED]; beginners@perl.org Subject: RE: Calling a subroutine

References and subroutine ?

2005-04-23 Thread Michael Gale
Hello, I have an array and I would like to pass it to a subroutine: printlist([EMAIL PROTECTED]); sub printlist { my $array_ref = (shift); my $max; my $maxnew = @{$array_ref}; for(my $i=0;$i $maxnew; $i++){ print \t\t\t\t\t

RE: References and subroutine ?

2005-04-22 Thread Charles K. Clarkson
Michael Gale mailto:[EMAIL PROTECTED] wrote: : I am passing the reference of an to the subroutine, which using : (shift) assigns the first scaler to my scaler array_ref. So now : array_ref scaler is equal to the passed scaler allowing me to use : array_ref as a reference. : : Correct ? Yes

Re: logfile rotate used as a subroutine with file passed by reference

2005-03-13 Thread Peter Scott
On Sat, 12 Mar 2005 21:54:23 -0500, DBSMITH wrote: All, Please audit my code as I cannot figure out the correct method to pass by ref into my logroll subroutine. Here is the error I am getting : Uncaught exception from user code: error: can not lock open: ($_) at I haven't

logfile rotate used as a subroutine with file passed by reference

2005-03-12 Thread DBSMITH
All, Please audit my code as I cannot figure out the correct method to pass by ref into my logroll subroutine. Here is the error I am getting : Uncaught exception from user code: error: can not lock open: ($_) at /usr/local/bin/ohiohealth/tapesz_chk.OH.pl line 115 Carp::croak

Re: Passing an object to a subroutine via hash?

2005-02-21 Thread Wiggins d'Anconia
Chris wrote: Greetings, I don't know what the proper terminology is for what I want to do, so if somebody can tell me what it is, that would be great. Basically I have my core code, then lots of subroutines. Right now I pass data to subroutines via a parameter hash. How can I pass an object

Re: Passing an object to a subroutine via hash?

2005-02-20 Thread alctraz
If you are only looking for the terminology, this is called 'Pass by Reference': http://www.perlpod.com/5.8.4/pod/perlsub.html#Pass%20by%20Reference On Sun, 20 Feb 2005 02:30:34 -0500, Chris [EMAIL PROTECTED] wrote: Greetings, I don't know what the proper terminology is for what I want to

Subroutine for a scripts progress

2005-02-02 Thread Gavin Henry
Dear all, I haven't coded anything yet, but I was wondering if it has been done, or can be done to write a small sub that can be called to show how a script is progressing? Like an on the sopt 1% 2% kind of thing or a hash progress? A small pointer to the correct feature/doc is all I am

RE: Subroutine for a scripts progress

2005-02-02 Thread Manav Mathur
you can use the perl debugger for that. see perldoc perldebug -Original Message- From: Gavin Henry [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 02, 2005 5:36 PM To: beginners@perl.org Subject: Subroutine for a scripts progress Dear all, I haven't coded anything yet, but I

RE: Subroutine for a scripts progress

2005-02-02 Thread Gavin Henry
PM To: beginners@perl.org Subject: Subroutine for a scripts progress Dear all, I haven't coded anything yet, but I was wondering if it has been done, or can be done to write a small sub that can be called to show how a script is progressing? Like an on the sopt 1% 2% kind of thing

Re: Subroutine for a scripts progress

2005-02-02 Thread Gavin Henry
quote who=Gavin Henry Dear all, I haven't coded anything yet, but I was wondering if it has been done, or can be done to write a small sub that can be called to show how a script is progressing? Like an on the sopt 1% 2% kind of thing or a hash progress? A small pointer to the

Subroutine redefined at ***.pm error

2005-01-31 Thread Anish Kumar K.
Hi I am using a perl module in which I have used some routines. and when I complile the script with perl -w .pm I get these errors( like routine redefined) Subroutine ExpiryMessage redefined at **.pm line 1200. Subroutine InstructorExpiryMessage redefined at ***.pm line 2454. Subroutine

RE: Subroutine redefined at ***.pm error

2005-01-31 Thread Michael Kraus
Developer Wild Technology Pty Ltd -Original Message- From: Anish Kumar K. [mailto:[EMAIL PROTECTED] Sent: Monday, 31 January 2005 7:42 PM To: beginners perl Subject: Subroutine redefined at ***.pm error Hi I am using a perl module in which I have used some routines. and when I

Hang with Use Warnings and a Subroutine

2005-01-27 Thread Graeme St. Clair
presenting anything on the new page. And nothing goes in Apache 'error.log'. The script contained what I'm going to call an in-line subroutine (for sorting, surprise, surprise). If that sub is moved down to the end of the script after the final 'exit 0', everything works. Any explanations occur

dynamically calling a subroutine

2005-01-18 Thread Absolut Newbie
I have a program that generates a random number between 1 and 6. based on the outcome I want to run a subroutine that corresponds to the result. i.e if the result is 1 then the program should run sub F1. my question is how can I dynamically call the subroutine. i tried this but obviously

Re: dynamically calling a subroutine

2005-01-18 Thread Stone
On Tue, 18 Jan 2005 20:05:01 +0200, Absolut Newbie [EMAIL PROTECTED] wrote: $var1(); # this is where it crashes You're looking for the eval command, which will read a string and evaluate the code it contains. ie: eval ( $var1() ); On on the other hand, you could do this with if statements.

RE: dynamically calling a subroutine

2005-01-18 Thread Moon, John
I have a program that generates a random number between 1 and 6. based on the outcome I want to run a subroutine that corresponds to the result. i.e if the result is 1 then the program should run sub F1. my question is how can I dynamically call the subroutine. i tried this but obviously

RE: dynamically calling a subroutine

2005-01-18 Thread Bob Showalter
Absolut Newbie wrote: I have a program that generates a random number between 1 and 6. based on the outcome I want to run a subroutine that corresponds to the result. i.e if the result is 1 then the program should run sub F1. my question is how can I dynamically call the subroutine. i tried

Re: dynamically calling a subroutine

2005-01-18 Thread Ron Wingfield
- Original Message - From: Stone To: beginners@perl.org Sent: Tuesday, January 18, 2005 12:20 PM Subject: Re: dynamically calling a subroutine On Tue, 18 Jan 2005 20:05:01 +0200, Absolut Newbie [EMAIL PROTECTED] wrote: $var1(); # this is where it crashes You're

Re: dynamically calling a subroutine

2005-01-18 Thread John W. Krahn
Absolut Newbie wrote: I have a program that generates a random number between 1 and 6. based on the outcome I want to run a subroutine that corresponds to the result. i.e if the result is 1 then the program should run sub F1. my question is how can I dynamically call the subroutine. i tried

Re: dynamically calling a subroutine

2005-01-18 Thread JupiterHost.Net
Absolut Newbie wrote: I have a program that generates a random number between 1 and 6. based on the outcome I want to run a subroutine that corresponds to the result. i.e if the result is 1 then the program should run sub F1. my question is how can I dynamically call the subroutine. i tried

subroutine problem

2004-12-01 Thread Michael Robeson
I have written a rather simplistic script so I can get used to LWP::Simple etc... Anyway I am using a subroutine to get and print data from a website. I have gotten it to work except for the fact that the first iteration of the subroutine uses no data at all, yet after that it works fine

Re: subroutine problem

2004-12-01 Thread Jonathan Paton
Dear Mike, Surprised you've been stumped for 3 hours, but sometimes the most obvious bugs are the hardest to find. In your code you have: ... printSequence; foreach my $id (@list) { ... That function call is causing your problem. Jonathan Paton -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: a question about the return value of a subroutine

2004-11-26 Thread Jeff 'japhy' Pinyan
On Nov 25, Zeng Nan said: 1 my @nums = (1..100); 2 my $result = total(@nums); 3 4 print $result\n; 5 6 sub total { 7 my $sum; 8 foreach(@_){ $sum += $_ } 9 $sum; 10 } My question is without line 9, the return value is nothing, while I expect it will return the value of $sum, as it is the

a question about the return value of a subroutine

2004-11-25 Thread Zeng Nan
Hi, Here is a simple program: 1 my @nums = (1..100); 2 my $result = total(@nums); 3 4 print $result\n; 5 6 sub total { 7 my $sum; 8 foreach(@_){ $sum += $_ } 9 $sum; 10 } My question is without line 9, the return value is nothing, while I expect it will return the value of $sum, as it

Re: a question about the return value of a subroutine

2004-11-25 Thread Ing. Branislav Gerzo
Zeng Nan [ZN], on Thursday, November 25, 2004 at 16:04 (+0800) typed the following: 6 sub total { 7 my $sum; 8 foreach(@_){ $sum += $_ } 9 $sum; 10 } ZN My question is without line 9, the return value is nothing, while I ZN expect it will return the value of $sum, as it is the last

Re: a question about the return value of a subroutine

2004-11-25 Thread Randy W. Sims
Zeng Nan wrote: Hi, Here is a simple program: 1 my @nums = (1..100); 2 my $result = total(@nums); 3 4 print $result\n; 5 6 sub total { 7 my $sum; 8 foreach(@_){ $sum += $_ } 9 $sum; 10 } My question is without line 9, the return value is nothing, while I expect it will return the value

Subroutine call

2004-11-24 Thread TapasranjanMohapatra
. my_script q should call the sub routine zzzq, my_script e should call the sub routine zzze, ... when there are many sub routines, if i get the name of subroutine as $name = zzz.$argument_received; can I call the sub routine as abc::$name; This does not work. Any suggestion, to get this done

RE: Subroutine call

2004-11-24 Thread Charles K. Clarkson
TapasranjanMohapatra [EMAIL PROTECTED] wrote: : Suppose I have many sub routines in a module abc.pm : : package abc; : : sub zzzq : { : } : : sub zzze : { : } : sub zzzr : { : } : : Now I use this module in another script. I want to call the : sub routines, as suggested by the argument passed

Re: Subroutine call

2004-11-24 Thread JupiterHost.Net
to call the sub routines, as suggested by the argument passed to the script. i.e. my_script q should call the sub routine zzzq, my_script e should call the sub routine zzze, ... when there are many sub routines, if i get the name of subroutine as $name = zzz.$argument_received; can I call the sub

Re: Subroutine call

2004-11-24 Thread Todd W
Charles K. Clarkson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] TapasranjanMohapatra [EMAIL PROTECTED] wrote: : Suppose I have many sub routines in a module abc.pm : : package abc; : : sub zzzq : { : } : : sub zzze : { : } : sub zzzr : { : } : : Now I use this

Re: Subroutine call

2004-11-24 Thread Lawrence Statton N1GAK/XE2
there are many sub routines, if i get the name of subroutine as $name = zzz.$argument_received; can I call the sub routine as abc::$name; This does not work. Any suggestion, to get this done? I'm guessing that your primary mission objective is to parse one of several commands at run-time

Re: Broken Subroutine

2004-10-21 Thread Gunnar Hjalmarsson
John W. Krahn wrote: Gunnar Hjalmarsson wrote: Here the loop is finished, but nothing is returned from the subroutine. return @basenames; Actually, something IS returned, it is just not something that the OP expects or wants. Yeah, I suppose it returns the null-string. Thanks for the correction

Broken Subroutine

2004-10-20 Thread Ron Smith
the subroutine to look like the following: filename filename filename filename filename filename filename filename filename filename framename framename framename framename framename framename shotname shotname shotname shotname shotname basename basename basename basename

Re: Broken Subroutine

2004-10-20 Thread Gunnar Hjalmarsson
assigns to @basenames the extracted basename from the last path only, i.e. the basenames extracted during previous iterations are not kept. You probably mean: push @basenames, $1; } } Here the loop is finished, but nothing is returned from the subroutine. return @basenames

Re: Broken Subroutine

2004-10-20 Thread Dan Jones
separated, but programmers sure do. For instance, do you mean for the array @basenames inside the subroutine to be the same as the array @basenames that you declared outside the subroutine? If so, why are you trying to assign a value to it when it's already (theoretically) being populated inside

Re: Broken Subroutine

2004-10-20 Thread John W. Krahn
, i.e. the basenames extracted during previous iterations are not kept. You probably mean: push @basenames, $1; } } Here the loop is finished, but nothing is returned from the subroutine. return @basenames; Actually, something IS returned, it is just not something that the OP

Re: Broken Subroutine

2004-10-20 Thread John W. Krahn
\shots\sp2\shot_1\sub_directory\basename.0009.rgb C:\Perl\scripts\shots\sp2\shot_1\sub_directory\basename.0010.rgb I want my output from the subroutine to look like the following: filename filename filename [snip] basename basename basename The following is the code: #!/usr/bin/perl -w use strict; my

Re: Help with putting a subroutine into a variable?

2004-09-26 Thread Gavin Henry
# send an email with @email_list # store to a database with @db_list Now your sub is generic, it doesn't rely on the specific names, @pics and $website, and doesn't cause data to be printed when you might not want it to. Obviously this is a contrived example but as things get more complex

Help with putting a subroutine into a variable?

2004-09-24 Thread Gavin Henry
the subroutine like links; but I want to put the result into a variable in order to stick it into an e-mail. I have been trying all day reading all my perl books and it's time to ask for help. Thanks. -- Just getting into the best language ever... Fancy a [EMAIL PROTECTED] Just ask

Re: Help with putting a subroutine into a variable?

2004-09-24 Thread Wiggins d Anconia
the subroutine like links; but I want to put the result into a variable in order to stick it into an e-mail. I have been trying all day reading all my perl books and it's time to ask for help. Note that we don't want to call Clinks that is better written as Clinks(). What is the result? In your case

Re: Help with putting a subroutine into a variable?

2004-09-24 Thread Gavin Henry
this subroutine into any Perl program in the world and know that we wouldn't mess up that program's $a and $b (if any).[109] - -- Just getting into the best language ever... Fancy a [EMAIL PROTECTED] Just ask!!! -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Help with putting a subroutine into a variable?

2004-09-24 Thread Gavin Henry
; } Doesn't this still get the scalar and array from what I defined at the top? Also, why do you assign them to @_, can't we use that when iterating @list? Why wouldn't it accept it's arguments? - I would normally call the subroutine like links; but I want to put the result

Re: Help with putting a subroutine into a variable?

2004-09-24 Thread Wiggins d Anconia
the calling syntax has to be different (see summary below). Also, why do you assign them to @_, can't we use that when iterating @list? I am not assigning them *to* @_, but *from* @_. In other words, when the subroutine is called it automatically stuffs the arguments given

Re: Net ::FTP and subroutine calls

2004-09-17 Thread DBSMITH
IT UNIX / TSM / EDM Teams 614-566-4145 Chris Devers [EMAIL PROTECTED] 09/16/2004 04:59 PM Please respond to Perl Beginners List To: [EMAIL PROTECTED] cc: Perl Beginners List [EMAIL PROTECTED] Subject:Re: Net ::FTP and subroutine calls On Wed, 15 Sep 2004

Re: Net ::FTP and subroutine calls

2004-09-17 Thread Chris Devers
On Fri, 17 Sep 2004 [EMAIL PROTECTED] wrote: Right thanks forgot about that! So how do I out this failed info to STDOUT (ftplog), b/c if it does fail I would want to know! First things first: does the version I sent yesterday work? Focus on getting the FTP transaction to finish

Re: Net ::FTP and subroutine calls

2004-09-17 Thread DBSMITH
[EMAIL PROTECTED] Subject:Re: Net ::FTP and subroutine calls On Fri, 17 Sep 2004 [EMAIL PROTECTED] wrote: Right thanks forgot about that! So how do I out this failed info to STDOUT (ftplog), b/c if it does fail I would want to know! First things first: does the version I

Re: Net ::FTP and subroutine calls

2004-09-17 Thread Chris Devers
On Fri, 17 Sep 2004 [EMAIL PROTECTED] wrote: yes my ftp code has always worked, so lets move on! Ok -- you didn't actually say that, you just said things don't work. The way you're using the die statement won't work. Go back to the docs and usual manuals to look for other ways to do this.

Re: Net ::FTP and subroutine calls

2004-09-17 Thread Colegate Spinks
DBSMITH at OhioHealth.com writes: ..snip.. I'm fairly new to Perl, but have been working on a similar typ problem and monitoring the success of my Net::FTP session. I used logic similarm to the following: my ftp; if($ftp = Net::FTP-new($remotehost)) { print Initial FTP successful\n; } else

Re: Net ::FTP and subroutine calls

2004-09-16 Thread Chris Devers
On Wed, 15 Sep 2004 [EMAIL PROTECTED] wrote: no nothing is showing up in the file. Okay then, so this logging code is all hand-written ? It seems then that nothing in this script is actually writing to the log file you've asked for, because there's no such thing as $ftp-$ftplog (or

Net ::FTP and subroutine calls

2004-09-15 Thread DBSMITH
($data) or die FTP put to IrMt failed, $ftp-$ftplog; $ftp-quit; } and I want to append the result data to my log file. I ran it and the files was 0 bytes. What am I doing wrong? Also, how and what do I use to call a subroutine block that is in another file from my MAIN

Re: Net ::FTP and subroutine calls

2004-09-15 Thread Chris Devers
the Net::FTP docs specifically recomment this kind of code. Also, how and what do I use to call a subroutine block that is in another file from my MAIN Perl program? Will you please provide a code example? The best way to do it is to make a package out of your subroutine (see the usual

Re: Net ::FTP and subroutine calls

2004-09-15 Thread DBSMITH
to Perl Beginners List To: [EMAIL PROTECTED] cc: Perl Beginners List [EMAIL PROTECTED] Subject:Re: Net ::FTP and subroutine calls On Wed, 15 Sep 2004 [EMAIL PROTECTED] wrote: The Python folks are right -- whitespace is your friend! Use it! sub

Re: Net ::FTP and subroutine calls

2004-09-15 Thread Chris Devers
On Wed, 15 Sep 2004 [EMAIL PROTECTED] wrote: no nothing is showing up in the file. Here is where I looked for information on Net::FTP http://search.cpan.org/~gbarr/libnet-1.19/Net/libnetFAQ.pod ok I will look in perldoc -f package. Is there a better place though? If you're

Undefined subroutine [...] called at [...] though sub and routine exist

2004-09-13 Thread Schlabach, Torsten
. Conceptionally this looks like this: FooModule.pm: package FooModule; sub usedLater; sub theFunctionCalledFromoutside{ ... ... usedLater( $argument ); } sub usedLater{ [... some code ...] } 1; The call usedLater( $argument ); leads to this errror Undefined subroutine FooModule

Re: Undefined subroutine [...] called at [...] though sub and routine exist

2004-09-13 Thread Jenda Krynicky
From: Schlabach, Torsten [EMAIL PROTECTED] I have a CGI script that is calling a perl module. One function in that module uses a sub which is defined only later in the source, but there is a forward declaration available for the function with sub. Conceptionally this looks like this:

RE: Undefined subroutine [...] called at [...] though sub and rou tine exist

2004-09-13 Thread Bob Showalter
); leads to this errror Undefined subroutine FooModule::usedLater called at ... Any idea where to search? This is code I did not write myself and others have reported it worked for them unter Perl 5.8.1. I have 5.8.0. I also tried with 5.8.5, but got the same error, so this does not look

AW: Undefined subroutine [...] called at [...] though sub and rou tine exist

2004-09-13 Thread Schlabach, Torsten
Well, it's not really MY code, but I will attach it. It is line 103 that breaks! (The call to genDialog.) Torsten -Ursprüngliche Nachricht- Von: Jenda Krynicky [mailto:[EMAIL PROTECTED] Gesendet: Montag, 13. September 2004 18:47 An: '[EMAIL PROTECTED]' Betreff: Re: Undefined subroutine

AW: Undefined subroutine [...] called at [...] though sub and rou tine exist

2004-09-13 Thread Schlabach, Torsten
Nachricht- Von: Bob Showalter [mailto:[EMAIL PROTECTED] Gesendet: Montag, 13. September 2004 18:50 An: 'Schlabach, Torsten'; '[EMAIL PROTECTED]' Betreff: RE: Undefined subroutine [...] called at [...] though sub and rou tine exist Schlabach, Torsten wrote: Dear list, I have a problem

Using do versus use for subroutine

2004-08-06 Thread Edward Wijaya
Hi, I would like to know which of this is better and what is the pro and cons: 1. A file mysub.pl which stored a subroutine, and later called by main file using: do mysub.pl or 2. A file mysub.pm and called in main file using : use mysub.pm Thanks so much for your time Regards, Edward WIJAYA

RE: Using do versus use for subroutine

2004-08-06 Thread Bob Showalter
Edward Wijaya wrote: Hi, I would like to know which of this is better and what is the pro and cons: 1. A file mysub.pl which stored a subroutine, and later called by main file using: do mysub.pl or 2. A file mysub.pm and called in main file using : use mysub.pm The second

How to pass two arrays as arg in a subroutine?

2004-08-05 Thread Edward Wijaya
Hi, I have a subroutine that take 2 arrays as argument. I dont' know how to construct it? sub mysub{ my (@array1, @array2) = @_; # is this correct? How do I do it? #process @array1 #process @array2 etc return @array3; } Please advice. Thanks so much for your time. Regards

RE: How to pass two arrays as arg in a subroutine?

2004-08-05 Thread kamal.gupta
go through perldoc perlref With Best regards, R. Kamal Raj Guptha. -Original Message- From: Edward Wijaya [mailto:[EMAIL PROTECTED] Sent: Thursday, August 05, 2004 3:37 PM To: [EMAIL PROTECTED] Subject: How to pass two arrays as arg in a subroutine? Hi, I have a subroutine that take 2

Re: How to pass two arrays as arg in a subroutine?

2004-08-05 Thread WilliamGunther
Have them pass the arrays as a reference. For example: @array1 = (1, 2, 3, 4, 5); @array2 = (6, 7, 8, 9, 10); mysub([EMAIL PROTECTED],[EMAIL PROTECTED]); sub mysub{ my ($array1, $array2) = @_; #process @{$array1} #process @{$array2} etc return @array3; } Look into

Re: How to pass two arrays as arg in a subroutine?

2004-08-05 Thread Edward Wijaya
Thanks so much Kamal, your explanation is very clear and complete. It works now. I learnt a great deal from it. Regards Edward WIJAYA Hope this is useful for you. For more on references go through perldoc perlref With Best regards, R. Kamal Raj Guptha. -- To unsubscribe, e-mail: [EMAIL

How do i return the end of file message in a subroutine?

2004-07-22 Thread jason corbett
I am using an application called Title to kick off jobs instead of using the cron. I am told that this application doesn't accept SQL embedded inside perl scripts unless the SQL or perl script returns the end of file message. What method in perl returns the eof message? is it sub myroutine

[The Subroutine] What is Use of uninitialized JOIN error?

2004-07-13 Thread jason corbett
Thanks all for the feedback on the WARNING message that I am getting. I know that I can turn warning off at that moment of code, but I want to know for my own knowledge what is the warning all about. So, here is the entire sub routine. NOTE** I declared @records as a global earlier.. JC sub

Re: [The Subroutine] What is Use of uninitialized JOIN error?

2004-07-13 Thread William . Ampeh
sub data_collect {unless (open(OUTFILE,$fourdayreport)) {die open(ERRORLOG, $errorlog) print ERRORLOG Sorry file $dayreport couldn't be created\n; return Failed;} else{ while( @record = $sth-fetchrow_array() ) { # no warnings; #INSERTED ::: #Since you are not

Re: [The Subroutine] What is Use of uninitialized JOIN error?

2004-07-13 Thread jason corbett
I used ---print OUTFILE join(,,@record), \n;--- that you suggested and still got the error. sub data_collect {unless (open(OUTFILE,$fourdayreport)) {die open(ERRORLOG, $errorlog) print ERRORLOG Sorry file $dayreport couldn't be created\n; return Failed;} else{ while(

Re: [The Subroutine] What is Use of uninitialized JOIN error?

2004-07-13 Thread William . Ampeh
What about manually stepping through the array elements? That is: for ( my $i = 0; $i $#record; $i++) { print $record[$i],; } print $record[$#record]\n; __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: [The Subroutine] What is Use of uninitialized JOIN error?

2004-07-13 Thread William . Ampeh
What about manually stepping through the array elements? That is: for ( my $i = 0; $i $#record; $i++) { print $record[$i],; } print $record[$#record]\n; __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: [The Subroutine...revisited] What is Use of uninitialized JOIN error?

2004-07-13 Thread jason corbett
Here is what I am doing. I shortend the sub, using local variables, and simplifying the whole thing to just print to screen. I use your loop once I collect the records into the @record variable and join them with ,... Still to no avail, that menacing warning stays. Thanks. my $sql=qq(

Re: [The Subroutine] What is Use of uninitialized JOIN error?

2004-07-13 Thread jason corbett
Use of uninitialized value in concatenation (.) or string at select_c.pl line 70 and error Use of uninitialized value in join or string at select_c.pl line 65. are whats showing up [EMAIL PROTECTED] wrote: What about manually stepping through the array elements? That is: for ( my $i = 0;

Re: [The Subroutine...revisited] What is Use of uninitialized JOIN error?

2004-07-13 Thread William . Ampeh
$recordlist=join(,,@record); #This statement is causing the problem Have you tried to see if there are any blank records in @record? __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

RE: [The Subroutine...revisited] What is Use of uninitialized JOIN error?

2004-07-13 Thread Ed Christian
jason corbett wrote: Here is what I am doing. I shortend the sub, using local variables, and simplifying the whole thing to just print to screen. I use your loop once I collect the records into the @record variable and join them with ,... Still to no avail, that menacing warning stays.

RE: [The Subroutine...revisited] What is Use of uninitialized JOIN error?

2004-07-13 Thread jason corbett
I have seen null values come up, but when I do this same query in SQL Plus (Oracle environment BTW), I am getting no null values. Ed Christian [EMAIL PROTECTED] wrote:jason corbett wrote: Here is what I am doing. I shortend the sub, using local variables, and simplifying the whole thing to

Executing a subroutine from a runtime chosen module

2004-07-10 Thread Octavian Rasnita
Hi all, Does anyone know how can I do something like: my $mod = Module.pm; #Then require this $mod module (using eval() #Then executing a certain subroutine from that module and getting the results. I found that I can require a module and execute it entirely but I am not able to choose

Re: Executing a subroutine from a runtime chosen module

2004-07-10 Thread Gunnar Hjalmarsson
Octavian Rasnita wrote: Does anyone know how can I do something like: my $mod = Module.pm; #Then require this $mod module (using eval() #Then executing a certain subroutine from that module and getting the results. I found that I can require a module and execute it entirely but I am not able

Re: Subroutine return values mixed.

2004-06-18 Thread Amit Kulkarni
HI , You need to declare @array as my @array after line 14 in subroutine. 13 sub color { 14 $map1 = shift; #NEW LINE- my @array ; 15 foreach $item(keys %$map1) 16 { push @array, $item;} 17 return [EMAIL PROTECTED]; 18} Regards

RE: Subroutine return values mixed.

2004-06-18 Thread Khan, Ahmer H
Thank you very much.That did work. A prime example of how painful being a newbie can be :) Ahmer -Original Message- From: Amit Kulkarni [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 11:07 PM To: [EMAIL PROTECTED] Subject: Re: Subroutine return values mixed. HI , You need

Subroutine return values mixed.

2004-06-17 Thread Khan, Ahmer H
Hi, I'm very new to Perl and am learning as I go along. I've been reading a lot of articles and perl books to enhance my expertise. I'm stuck on a problem where the content of the arrays returned back from a common subroutine call are getting mixed up. Here is the code

undefined subroutine with recursives uses

2004-04-26 Thread 3li.marion
I encounter a very strange problem with interactions between main program and several modules. If there is no interaction between modules (module1 calling module2 and module2 calling module1) there is no problem with any sub each module. But if the mod1 uses 'use mod2' and mod2 uses 'use

Sending a parameter to a subroutine

2004-04-13 Thread J. Alejandro Ceballos Z.
I've created a subrutine to acces DB, but while sending the Query it get an error. My function looks like: sub DbSqlQuery { local $str_query = @_ if @_; print $str_query; ... blah, blah .. } And my program call it like: ... blah, blah .. $str_Query = SELECT admin_ID, admin_name FROM

Re: Sending a parameter to a subroutine

2004-04-13 Thread Paul Archer
I've created a subrutine to acces DB, but while sending the Query it get an error. My function looks like: sub DbSqlQuery { local $str_query = @_ if @_; (Why are you using local? 'local' is deprecated in favor of 'my'.) $str_query is a scalar, @_ is an array. Putting a scalar on

Re: Sending a parameter to a subroutine

2004-04-13 Thread Brad Lhotsky
Ok, there's a few points I'd like to make. read: perldoc perlvar AND perldoc perlsub before continuing ;) #1 local() is for perl's Variables, my() is for your variables. #2 an array in scalar context evaluates to the number of elements in the list, hence the 1. I believe

Subroutine and @_ confusion

2004-04-05 Thread Angie Ahl
); I read in Perlsub that doing FindLink will pass the current @_ to the subroutine. Great. But I thought that doing FindLink(LinkID = $id); would not pass the current @_ which is what I want. ie I only want to pass the param LinkID not all the other stuff that was passed to the subroutine

Re: Subroutine and @_ confusion

2004-04-05 Thread WilliamGunther
to, so it's not going to look good, or really do any good for anyone. I read in Perlsub that doing FindLink will pass the current @_ to the subroutine. Great. But I thought that doing FindLink(LinkID = $id); would not pass the current @_ which is what I want. ie I only want to pass the param

RE: Subroutine and @_ confusion

2004-04-05 Thread Bob Showalter
Angie Ahl wrote: ... These subroutines are called externally ie HLOM::Links-FindLink(LinkID = $id); but also internally ie FindLink(LinkID = $id); I read in Perlsub that doing FindLink will pass the current @_ to the subroutine. Great. Only if you omit the argument list as well

Re: Subroutine and @_ confusion

2004-04-05 Thread gohaku
-FindLink(LinkID = $id); I have seen shift used in Subroutines like: NumberOfApples = shift(@_);, any reason for writing the subroutine that way? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Subroutine and @_ confusion

2004-04-05 Thread Angie Ahl
Thanks Will Bob. using $class-FindLink(LinkID = $LinkID); has fixed it. I needed to use it for every internal call to a subroutine within my package and I'm now getting exactly what I needed. For the archives purpose, use subroutine_name instead of $class-subroutine_name passed

Re: Subroutine and @_ confusion

2004-04-05 Thread WilliamGunther
In a message dated 4/5/2004 11:25:56 AM Eastern Daylight Time, [EMAIL PROTECTED] writes: I have seen shift used in Subroutines like: NumberOfApples = shift(@_);, any reason for writing the subroutine that way? You'll frequently see shift in subs. Like $class = shift; (Default for shift

Re: Passing file name /filehandle as argument to a subroutine...

2004-03-27 Thread R. Joseph Newton
urvashi mishra wrote: hi; i am trying to take input from multiple files Various I/P files are specified at command line... What is an I/P file? Do you mean an input file? Can anyone tell me how to pass the file name to a routine that opens it for parsing the same function is

Re: Passing file name /filehandle as argument to a subroutine...

2004-03-27 Thread R. Joseph Newton
R. Joseph Newton wrote: Better not to use the newline at the end. You get more information if you just: open(MIBFH,$file) or die Error opening the $file$!; Should be: open(MIBFH,$file) or die Error opening the $file: $!; Sorry, Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Passing file name /filehandle as argument to a subroutine...

2004-03-25 Thread John W. Krahn
Urvashi Mishra wrote: hi; Hello, i am trying to take input from multiple files Various I/P files are specified at command line... Can anyone tell me how to pass the file name to a routine that opens it for parsing the same function is to be called for all the I/P files...

Passing file name /filehandle as argument to a subroutine...

2004-03-23 Thread urvashi mishra
hi; i am trying to take input from multiple files Various I/P files are specified at command line... Can anyone tell me how to pass the file name to a routine that opens it for parsing the same function is to be called for all the I/P files... Code is: foreach my $file (@ARGV) {

<    2   3   4   5   6   7   8   9   10   11   >