> -----Original Message----- > From: Scott [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 10, 2002 10:40 AM > To: [EMAIL PROTECTED] > Subject: Manageable code > > > I admit I am a newbie and making this harder than it really > is :) But, I > have a program that is growing by the minute and I want to > split it apart > into chunks or sub routines. > > Here is an example: > > sub init_type_99{ > print NEWQUOTES "99"; #RecordType > printf NEWQUOTES ("%08d", "1"); #FileBatchTotal > printf NEWQUOTES ("%08d", $count-1); #TotalRecords > printf NEWQUOTES ("%-237s"); #RecordFiller > print NEWQUOTES "\n"; > } > > Yet when I call the sub doing this: > > init_type_99(); > I do not get the results I was looking for.
What exactly is happening? No output? Wrong output? Compile error? The code on its face looks OK. Are you opening NEWQUOTES before calling your sub? Do you have 'use strict' enabled? Is $count a global, or a file-scoped lexical? > Is it a bad idea > to do a sub > like this and reserve it to only return a value? No, not a bad idea. But always 'use strict' and 'use warnings' (or -w) to catch potential problems. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]