Daniel Falkenberg wrote:
> 
> Hey all,

Hello,

> I am just working on a small text file and was wondering if a regular
> expression would help me here.  Basically the text file looks like
> this...
> 
> 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
> 
> Now I want to extract the following...
> 
> 1: All digits after Pre-paid hours: including a period (.).
> 2: All digits after Hours user so far: including a period (.).
> 3: All digits after Excess Hours billed at: including a period (.).
> 4: All digits after Pre-paid megabytes: including a period (.).
> 5: All digits after Used so far: including a period (.).
> 6: All digits after Excess Megabytes billed at: including a period (.).
> 
> 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.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to