[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Wildcard



At 18.01 +0200 98-09-23, tboley wrote:
>Is there a way to use wildcards in perl? It would be nice if the folowing
>would work:
>
>if ($text eq "t*") {print "$text\n"} # Where * is a wildcard
>
>So the print comand is executed when $text is "tee" or "time" or ...

Perl is even nicer! It doesn't have just wildcards, it has full regular
expression support.

$text =~ /t/     # tee or time or anything else with 't' in it.
$text =~ /^t/    # tee or time or anything else starting with 't'.
$text =~ /^t/i   # Anything starting with 't' or 'T'.
$text =~ /t.o/   # too or two or t8o, but not to or toe.

For the full story, get a book on Perl. One of the better, MacPerl: Power
and Ease, is at http://www.ptf.com/macperl/ptf_book/


___Carl_Johan_Berglund_________________________
   Adverb Information
   carl.johan.berglund@adverb.se
   http://www.adverb.se/



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch