Good morning list ;-)
I solved my problem yesterday before any answer arrived *fg* Now I've got an 'nacadminlib.epl' which contains... ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [- use nactools; -] [$ sub interface_list $] [- @interfacelist = @_; -] [$ if ($#interfacelist >= 0) $] <tr class=heading> <th>Mon</th> <th>Device</th> <th>Interface</th> <th>Speed</th> <th>Line</th> </tr> [$ foreach $indx ( 0 .. $#interfacelist ) $] <tr class=light> <td class=[+ $interfacelist[$indx][0] +]><a>[+ $interfacelist[$indx][1] +]</a></td> <td><a href="view-device.epl?id_device=[+ $interfacelist[$indx][2] +]" >[+ $interfacelist[$indx][3] +]</a></td> <td><a href="view-interface.epl?id_interface=[+ $interfacelist[$indx][4] +]">[+ $interfacelist[$indx][5] +]</a></td> <td align=right><a>[+ prettyspeed ($interfacelist[$indx][6]) +]</a></td> <td><a href="view-line.epl?id_line=[+ $interfacelist[$indx][7] +]">[+ $interfacelist[$indx][8] +]</a></td> </tr> [$ endforeach $] [$ else $] <tr><td colspan=5><a>no interfaces</a></td></tr> [$ endif $] [$ endsub $] ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ....and I call it with '[- interface_list (@interfacegrp) -]'. One of you wrote that i shouldn't pass the array instead a hashref to the array....WHY? I'm coding perl and embperl for a year now but I still don't know wheter I should use an array/hash or a reference. Can somebody explain the pros/cons of each? THX Alex ##################### 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 (" <tr class=heading> <td>Mon</td> <td>Device</td> <td>Interface</td> <td>Speed</td> <td>Line</td> </tr> "); for $indx ( 0 .. $#interfacelist ) { print (" <tr class=light> <td class= $interfacelist[$indx][0] ><a> $interfacelist[$indx][1] </a></td> <td><a href='view-device.epl?id_device=$interfacelist[$indx][2] '> $interfacelist[$indx][3] </a></td> <td><a href='view-interface.epl?id_interface= $interfacelist[$indx][4] '> $interfacelist[$indx][5] </a></td> <td><a href='view-line.epl?id_line= $interfacelist[$indx][6] '> $interfacelist[$indx][7] </a></td> </tr> "); }; } ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]