On Thursday, August 07, 2003 11:28, Dan Muey wrote: >>>sub dump_functions { >>> use Class::Inspector; >>> my $r = ref $_[0]; >>> return [ grep /^$r/, @{ >>>Class::Inspector->methods($r,'full','public')} ] } >> >> Yeah. The 'return' keyword can even be left out. > >Nice! I'll leave it in for readability I think. > >Wouldn't it need a ';' at the end? >[ grep ...... ]; > >Or am I once again missing something I should know?
You can leave out the last semicolon in a block, but I never do. It doesn't hurt to have it there, and may save you if later you were to add another statement after it but forget to add the semicolon to what *was* the last statement. I also always put in the return keyword. It enhances readability as you say, and you don't have to remember that Perl returns the last result. There are a lot of shortcuts that Perl allows for that I avoid, to enhance readability and preserve my sanity. Heck, I even put "use English;" at the top of my programs and use $PREMATCH, $MATCH, and $POSTMATCH instead of $`, $&, and $' because otherwise, I always have to look them up to remember what the shortcut variables are. Although, I still use $_, $1, $2, etc. Go figure... Alan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]