in reply to Re^2: Can't use string ("1") as a SCALAR ref while "strict refs" in use
in thread Can't use string ("1") as a SCALAR ref while "strict refs" in use
This may also work:
if ( my ($open_bal, $net_trx, $cash_total, $card_total, $cheque_total, $grand_total) = $body_text =~ /\$(\S+)/g ) { tr/,//d for $open_bal, $net_trx, $cash_total, $card_total, $cheque_total, $grand_total; print ... }
With both this solution and the original solution, you can use apply to shorten the code.
use List::MoreUtils qw( apply ); if ( my ($open_bal, $net_trx, $cash_total, $card_total, $cheque_total, $grand_total) = apply { tr/,//d; } $body_text =~ /\$(\S+)/g ) { print ... }
|
|---|