APM: some simple questions

Wayne Walker wwalker at bybent.com
Tue Jan 27 12:40:35 CST 2004


On Tue, Jan 27, 2004 at 12:10:43PM -0600, Goldilox wrote:
> is it better form to do this:
> 
> while($exlen > 0){$indent=$indent."  ";$exlen=$exlen-1;}
> 
> or this
> 
> while($exlen){$indent=$indent."  ";$exlen=$exlen-1;}
> 
> (or is the second one even going to work?)

Both should work (didn't test it, nor did I test this...)
This should also work

$indent .= ("  " x $exlen);

see "perldoc perlop"  search for " x "  minus the quotes

> 2nd question: 
> why do sometimes I have to call a subroutine with an ampersand 
> 
> &subroutine();
> 
> and other times can just say the name of the subroutine
> 
> subroutine;

Perl understands any subroutine that is builtin, or has already been
defined (above where it's being called) is a subroutine.  If you define
it later in the program file, perl doesn't know yet that it's a sub.
> 
> ??
> 
> Thanks for help, advice, etc!
> 
> Rhett
> 
> _______________________________________________
> Austin mailing list
> Austin at mail.pm.org
> http://mail.pm.org/mailman/listinfo/austin

-- 

Wayne Walker
wwalker at bybent.com                 Do you use Linux?!
http://www.bybent.com              Get Counted!  http://counter.li.org/
Perl - http://www.perl.org/        Perl User Groups - http://www.pm.org/
Jabber IM:  wwalker at jabber.phototropia.org       AIM:     lwwalkerbybent



More information about the Austin mailing list