2007/8/24, Mihir Kamdar <[EMAIL PROTECTED]>:

> But a few improvizations. $cdr[13] that I am trying to manipulate is a
> "amount" field and should be a floating point value...how can I print it as
> floating point in perl?
>

Perl isn't a strong type language,it doesn't mind which data type it used.
You can use printf() for printing a floating vlaue,like,
$ perl -e 'printf("%.2f",3)'
3.00

> Also I am reading from an input file and writing to an output file. Is it
> possible to read and write to the same file without any side-effects??
>

Yes,just open the file for reading and handling,store the results to
an array as you did,close  the file.then re-open the file for
writing,and write the content in the array to the file.It's no
problem.


> @Jeff:- As you said that @[EMAIL PROTECTED] is different with $hash{"@arr"}, 
> I am
> sorry but I am not sure what you are trying to point out through this.

@[EMAIL PROTECTED] means this hash has more than one keys (given the @arr has
3 elements,then this hash has 3 keys,each key is one of this array's
elements).
$hash{"@arr"} means the hash has only one key,it's the same as:
$key = join '',@arr;
$hash{$key} = ...;

Also @[EMAIL PROTECTED] is a hash slice,but $hash{"@arr"} isn't.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to