perl script help

Shaun Friedle shaun at insipidity.co.uk
Fri Apr 16 13:59:06 PDT 2004


On Fri, 2004-04-16 at 17:05, JJB wrote:
> I know nothing about writing perl scripts.
> 
> Can somebody show me how to  add the : in the output 
> of the date command in the simple following script?

Try this:

#!/usr/bin/perl
$timezone=`date +\%z`;			#Gets the offset in $timezone
$timezone =~ s/(\+[0-9][0-9])/$1:/;	#Replaces ±NN with ±NN:
print $timezone;			#Prints $timezone


-- 
Shaun Friedle
shaun at insipidity.co.uk



More information about the freebsd-questions mailing list