Return-Path: Delivered-To: apmail-perl-embperl-archive@perl.apache.org Received: (qmail 33681 invoked by uid 500); 20 Feb 2003 00:41:55 -0000 Mailing-List: contact embperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list embperl@perl.apache.org Received: (qmail 33668 invoked from network); 20 Feb 2003 00:41:54 -0000 Date: Wed, 19 Feb 2003 18:41:51 -0600 (CST) From: Ed Grimm Reply-To: Ed Grimm To: Alexander Hartmaier cc: embperl@perl.apache.org Subject: Re: UPD: output table with variable data In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N If you're going to call the sub in a [+ +] block, you should have the result returned, not printed. Note that, as others have mentioned, this is not the standard embperl way of doing things, but it's an option. > sub interface_list (@interfacelist) > { my $res = " > > Mon > Device > Interface > Speed > Line > > "); > for $indx ( 0 .. $#interfacelist ) > { $res .= " > > $interfacelist[$indx][1] > > > $interfacelist[$indx][3] > > $interfacelist[$indx][5] > > $interfacelist[$indx][7] > > "); > }; return res; > } Ed On Wed, 19 Feb 2003, Alexander Hartmaier wrote: > > > Hi again! > > I made a mistake at the variable passing ;-) > Now this works: > > sub interface_list (@) > { > my @interfacelist = $_[0]; > . > . > . > } > > But it's still outputted at the end of the page instead of where I call the sub. > I also don't like the print statements. > > Any Idea? > > THX Alex > > ##################### > > Hi list! > > I have to output a html table in some of my embperl pages which always looks the > same but the data is slightly different. > My approch was to write a small sub which takes the array with the data and > looks like this: > > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > sub interface_list (@interfacelist) > { > print (" > > Mon > Device > Interface > Speed > Line > > "); > for $indx ( 0 .. $#interfacelist ) > { > print (" > > $interfacelist[$indx][1] > > > $interfacelist[$indx][3] > > $interfacelist[$indx][5] > > $interfacelist[$indx][7] > > "); > }; > } > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > My problem is that when I call the sub with '[+ interface_list (@interfacegrp) > +]' the lines are appended to the end of the output instead of the line where I > call it! > Furthermore the array @interfacelist is empty... > > I think there is a better way to handle this problem! > Gerald or anybody else has an idea? > > THX Alex > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org > For additional commands, e-mail: embperl-help@perl.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org For additional commands, e-mail: embperl-help@perl.apache.org