You can try using sprintf function to treat the numeric as string..

On 15 June 2010 21:10, mrwawa <wade.w...@gmail.com> wrote:

> Hi all,
>
> I am new to Perl and am trying to do the following.  I have a dataset
> file with the following example structure.
>
> ACRU   12   34
> QUAL     28  90
> QURU    3345
> . . . . .
> QUVE    29  88
>
> As you can see, line 3 only contains on 2 columns.  "3345" is missing
> a tab.  I have written code to loop through the file and locate those
> spots.  What I would like to do is edit the rows in the data file that
> have < 3 columns by using substr().  However, when I read each line in
> as an array, the numeric values are stored as numbers and I am unable
> to parse them.  For example $temp = substr(dat[0],0,2) works for the
> first element in the array, but $temp = substr(dat[1],0,2) does not
> work for the numeric values.  I receive the error message, "Use of
> uninitialized value $dat[2] in string".  Is there a way around this?
>
> thanks for any help.
>
> Wade
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to