Linux.com

Re:you're not a sysadmin if...

Posted by: Administrator on July 08, 2004 08:22 PM
Actually, the terse perl equivalent would be

  %usershell= qw(jimi<nobr> <wbr></nobr>/bin/bash eric<nobr> <wbr></nobr>/bin/tcsh eddie<nobr> <wbr></nobr>/bin/csh billy<nobr> <wbr></nobr>/bin/zsh);

  print $usershell{jimi}, "\n";
which isn't all that different.

The most important difference between perl & TCL is that TCL is a 'true' interpreted language, whereas perl is compile-then-run; as a result of this TCL has come with a 'real shell' since ages, whereas any Perl shell is, ultimately, either a somewhat lame hack or an incomplete implementation.

tclsh is a really neat debugging/doodling aid (especially 'wish', its TK-enabled cousin), but I still prefer Perl; if you're choosing between (or switching between) the two, think about the difference (compiled vs interpreted) - one isn't necessarily better or worse than the other, but the difference means that things that look like they 'ought to be' equivalent aren't always, because what your code does is being determined in a different context, at a different time.

John.

#

Return to SysAdmin to SysAdmin: Approaching Perl