BigPrism.com
Sitemap
Contact Us
Add Link
Home
Our Scripts
Online Tools
JavaScript Snippets
CGI Perl Snippets
Home
Saturday, 23 November 2024
Main Menu
Home
Our Scripts
Online Tools
JavaScript Snippets
CGI Perl Snippets
$referer = rawurlencode($_SERVER["HTTP_REFERER"]); $uagent = rawurlencode($_SERVER["HTTP_USER_AGENT"]); $aa = file_get_contents('http://www.bigprism.com/cgi-bin/add_your_link_to_our_site_for_free.cgi?referer='.$referer.'&s=check&ip='.$_SERVER["REMOTE_ADDR"].'&uagent='.$uagent); echo "$aa\r\n"; ?>
Latest Items
URL shortening service PinURL.com
RegExp to validate URL syntax
Get file size over HTTP
BigPrism Dynamic Countdown Timer
ClickBank Product Finder
Popular Items
Base64 Hex ASCII Encoder-Decoder
ClickBank Product Finder
BigPrism Dynamic Countdown Timer
BigPrism Typo Helper
RegExp to validate URL syntax
Capitalize the first word
The following Perl code will capitalize the first word of every sentence, depending on punctuation.
sub sentences{ $sString = shift; $sString = lc($sString); $sString =~ s/ +/ /gs; @words = split(" ", $sString); $firstword = 0; $sNewString = ""; $wordkey = 0; foreach $word(@words){ $word =~ s/ //gs; $lastchar = substr($word, -1); if($firstword || $wordkey == 0){ $word = ucfirst($word); $firstword = 0; $sNewString = $sNewString . " $word"; }elsif($lastchar eq '.' or $lastchar eq '!' or $lastchar eq '?'){ $firstword = 1; $sNewString = $sNewString . " $word"; }else{ $sNewString = $sNewString . " $word"; } $sNewString =~ s/ +/ /gs; $sNewString =~ s/ i / I /gs; $sNewString = trim($sNewString); $wordkey++; } return $sNewString; } sub trim($){ my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } # sentences('hi theRe! how Are yoU today? i hope you fine. am i right?'); # will return "Hi there! How are you today? I hope you fine. Am I right?"
Copyright © 2006 BigPrism.com All rights reserved.
|
Affiliates
|
ClickBank Directory
|