develooper Front page | perl.beginners | Postings from February 2002

Re: Regex...

Thread Previous | Thread Next
From:
zentara
Date:
February 28, 2002 07:52
Subject:
Re: Regex...
Message ID:
rtjs7u00thu4c3gugp09hbaogirc5cni79@4ax.com
On Wed, 27 Feb 2002 16:11:55 -0800, krahnj@acm.org (John W. Krahn) wrote:

>Daniel Falkenberg wrote:
>> Would this be the best way of going about this?  If so where do I start
>
>
>my $text = <<EOT;
>User data query User data query Time utilization for this billing period
>Pre-paid hours:  744  Hours used so far:  29.55  Excess hours billed at:
>$1.00 per hour  Traffic utilization for this billing period Pre-paid
>megabytes:  500  Megabytes used so far:  60.52  Excess Megabytes billed
>at:  $0.18 per Megabyte
>EOT
>
>my $pre_paid_hours    = $1 if $text =~ /Pre-paid\s+hours:\s+([\d.]+)/i;
>my $hours_used_so_far = $1 if $text =~
>/Hours\s+used\s+so\s+far:\s+([\d.]+)/i;
># etc.

Uh oh John, I got an error when running this. 
Use of unitialized value in concantation at  my $text = <<EOT

It should be    my $text ='EOT'; 

That cleared up a misunderstanding I had about here documents.
I had thought here documents were always string literals.
The string is interpolated according to the quotes used, and it defaults
to "".




Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About