On 27 Jun 2001 17:59:12 +0200, Aaron Craig wrote:
> Just to make it longwinded:
> 
> my $stuff = { $var1 => "-" , $var2 => "-" , $var3 => "-" };
> my $newvar = "";
> $newvar .= "$_$stuff->{$_}" foreach keys %{ $stuff };
> 

This is not guarenteed to produce the desired results (keys in a hash
have an unknown order) and $var3's value in the hash should by "" not
"-" (or you need to chop at the end).

> 
> At 11:45 27.06.2001 -0400, Chas Owens wrote:
> >On 27 Jun 2001 10:06:28 -0400, Chas Owens wrote:
> > > On 27 Jun 2001 14:37:14 +0100, Pierre Smolarek wrote:
> > > > > On Wed, Jun 27, 2001 at 02:07:22PM +0100, Pierre Smolarek wrote:
> > > > > > $newvar = $var1."-".$var2."-".$var3;
> > > > >
> > > > > or $newvar = "$var1-$var2-$var3";
> > > >
> > > > or
> > > >
> > > > $concat = '-';
> > > > $newvar .= $var1;
> > > > $newvar .= $concat;
> > > > $newvar .= $var2;
> > > > $newvar .= $concat;
> > > > $newvar .= $var3;
> > > >
> > > > dude, you should really look this up in a book.. its pre-basic perl
> > > >
> > > >
> > > or
> > >
> > > $newvar = join "-", ($var1, $var2, $var3);
> > >
> > > TMTOWTDI
> > >
> > > --
> > > Today is Pungenday, the 32nd day of Confusion in the YOLD 3167
> > > Wibble.
> > >
> > >
> > >
> >
> >or
> >
> >$newvar='';$newvar .= "$_-" foreach ($var1, $var2, $var3); chop $newvar;
> >
> >or
> >
> >$newvar = sprintf "%04d-%02d-%02d", $var1, $var2, $var3;
> >
> >or
> >
> >$newvar =~ s/.*/$var1-$var2-$var3/;
> >
> >I think I need a life.
> >
> >--
> >Today is Pungenday, the 32nd day of Confusion in the YOLD 3167
> >Kallisti!
> 
> Aaron Craig
> Programming
> iSoftitler.com
> 
> 
--
Today is Pungenday, the 32nd day of Confusion in the YOLD 3167
Wibble.


Reply via email to