#!/usr/bin/perl -wT
use CGI':standard';
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
my $yogi; my $q2;
print "Content-type: text/html\n\n";
print "<!DOCTYPE html>";
print "<html><head><title>Substrings</title></head>";
print "<body><div style='font-family:monospace'>";
#substrings examples
$yogi = "When you come to a fork in the road take it! -- Yogi Berra";
print "<div>$yogi</div>";
print "<div style='color:#990000;margin-top:10px;'>";
print substr($yogi, 0, 8);
print "</div>";
print "<div style='color:#660066;margin-top:10px;'>";
print substr($yogi, 37);
print "</div>";
print "<div style='color:#000099;margin-top:10px;'>";
print substr($yogi, -10, 4);
print "</div>";
print "<div style='color:#006666;margin-top:10px;'>";
print substr($yogi, 4, -10);
print "</div>";
substr($yogi, 19, 4, "????");
print "<div style='background-color:#ffff00;margin-top:10px;'>";
print $yogi;
print "</div>";
substr($yogi, 19, 4, "fork");
substr($yogi, 45, 2) = "";
print "<div style='color:#666600;margin-top:10px;'>";
print $yogi;
print "</div>";
substr($yogi, 0, 0) = "<span style='font-weight:bold;'>";
print "<div style='color:#0000ff;margin-top:10px;'>";
print $yogi . "</span>";
print "</div>";
print "</div></body></html>";
SubstringsWhen you come to a fork in the road take it! -- Yogi Berra
When you
ake it! -- Yogi Berra
Yogi
you come to a fork in the road take it! --
When you come to a ???? in the road take it! -- Yogi Berra
When you come to a fork in the road take it! Yogi Berra
When you come to a fork in the road take it! Yogi Berra