Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Apr 2004 21:59:05 +0100
From:      Shaun Friedle <shaun@insipidity.co.uk>
To:        Barbish3@adelphia.net
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: perl script help
Message-ID:  <1082149145.280.9.camel@Shaun>
In-Reply-To: <MIEPLLIBMLEEABPDBIEGAEBCFMAA.Barbish3@adelphia.net>
References:  <MIEPLLIBMLEEABPDBIEGAEBCFMAA.Barbish3@adelphia.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2004-04-16 at 17:05, JJB wrote:
> I know nothing about writing perl scripts.
>=20
> Can somebody show me how to  add the : in the output=20
> of the date command in the simple following script?

Try this:

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


--=20
Shaun Friedle
shaun@insipidity.co.uk



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1082149145.280.9.camel>