Perl valid email regular expression
Tuesday, February 1st, 2011# Check for valid email address
/
^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$
/
# Check for valid email address
/
^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$
/
example:
my $text = “This is one heck of a story”;
my $swap = “heck”;
my $replacement = “hell”;
substr($text, index($text, $swap), length($swap), $replacement);
print $text;
sub spacer
{ print “<br />”; }
my $text = “This is one heck of a story”;
# remove the last character
print chop($text); spacer(); # returns y
print $text; spacer(); # we can see that it also DID alter the variable
# remove newlines from the end of a string only
$text = $text . “\n\n”;
print $text; spacer();
print chomp($text); spacer(); # again, returns # of items “chomp”ed
print $text; spacer();
# outputting pretty HTML
# basically a matter of including \n
# and using Perl qq function
my (@time,@days,@months,$time,$days,$months);
@time = localtime;
@days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
@months = qw(January February March April May June July August September October November December);
print qq(\n<html>\n<head>\n<title>Get the date</title>\n</head>\n<body>\n);
print qq(Today is <strong>$days[$time[6]], $months[$time[4]] $time[3]</strong>.);
print “\n</body>\n”;
print ‘</html>’;
I was stuck for a bit there.
I have a page that loads via AJAX, but I had to modify it to work for Google’s googlebot #! system…
The googlebot logic senses that it’s googlebot, and uses PHP includes instead of the AJAX!
Well the includes don’t need the session_start() again, but the AJAX loads DO!
So, NOT to be forgotten, session_start() will work per LOAD, hard to explain that, but you can wrap your head around it…
fancy!
BETTER SOLUTION: Sessions manager class, framework or similar…