This is the Regular Expression equivalent of HelloWorld.pl, and my all-time favorite greedy/ungreedy match example.
#/usr/bin/perl #GREEDY $_ = "Mississipi"; /(i.*ss)/; print $`."---->".$&."<----".$'; #Prints: M---->ississ<----ipi #NOT GREEDY $_ = "Mississip"; /(i.*?ss)/; print $`."---->".$&."<----".$'; #prints M---->iss<----issipigreedy.pl
For more info: Mastering Regular Expressions

