A couple minor points. First, "! -z" is more commonly known as "-n". Second, if you're running perl from the commandline anyway, use lib is usually called -I, while all other uses are called -M. And rather than dealing with lots of annoying quotes, just pass in your parameters.

figlet() { local que=$1 local fu=timesofl if [ -n "$2" ] then local fu=$2 fi; if [ -n "$que" ] then perl -I$HOME/path/to/installed/FIGlet.pm -MText::FIGlet -e 'pr +int Text::FIGlet->new(-f=>$ARGV[0])->figify(-A=>$ARGV[1])' "$fu" "$qu +e" fi; }
Unlike in perl where quoting a variable is a waste of time, in shell it's imperative to keep any embedded spaces unchanged. Having moved your variables from inside the perl code to purely in shell, I need to keep the quotes - but I can get rid of leaning toothpick syndrome (LTS). And then I can switch your double quotes to single quotes and now I think the whole command is much easier to look at. Personally, I would have made the whole thing just a perl script to begin with:
#!/usr/bin/perl use lib "..."; # probably not really needed. use Text::FIGlet; my $figlet = Text::FIGlet->new(-f => $ARGV[1] || 'timesofl'); print $figlet->figify(-A => shift);
Of course, I'd add more comments and whatever. ;-)


In reply to Re: POD Figlet titles by Tanktalus
in thread POD Figlet titles by chanio

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.