you used split before, use it again....


Dean

[EMAIL PROTECTED] wrote:
> 
> Yeah I was thinking drop the decimal too.. any idea how?
> Sorry, I am not a perl programmer... not yet anyways, never had time to read
> the books, just trying to fudge some data..
> 
> Quoting Dean Hamstead <[EMAIL PROTECTED]>:
> 
> > Im not sure if perl thinks they are actually numbers
> > infact i think it just considers them as strings
> >
> > but anyway you could just drop the decimal place.
> >
> > Dean
> >
> > [EMAIL PROTECTED] wrote:
> > >
> > > Hi all,
> > >
> > > Quick question in for those perl programmers.. here is an extract of
> > some of my
> > > code..
> > >
> > > open(DATA, $stats_file) || die "Can't open $stats_file: $!";
> > >
> > > while (<DATA>)
> > > {
> > >     my ($data1,$data2);
> > >     chop;
> > >     ($data1,$data2) = split(/,/);
> > >     print "$data1\n";
> > >     print "$data2\n";
> > > }
> > > close(DATA);
> > >
> > > Now my question is, $data1 and $data2 are numbers, sometimes for
> > example 100,10
> > > while at other times 100.5,10.6
> > >
> > > My question is, how can I implement some code into the above, so that
> > when the
> > > two print statements run, it rounds up any such 100.5,10.6 code to
> > normal
> > > 101,11.
> > >
> > > Basically I don't want decimal points in the final output.
> > >
> > > Hope someone can help.
> > >
> > > Cheers
> > > Michael
> > > --
> > > SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
> > > To unsubscribe send email to [EMAIL PROTECTED] with
> > > unsubscribe in the text
> >
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text

Reply via email to