in reply to newb regular expression question
Now if you need to parse a lease further, you could do something like:#!/usr/bin/perl -w use strict; open (LEASE, "lease.file") or die "Unable to open input file : $!"; $/ = "\n}\n"; while (defined (my $lease = <LEASE>)) { next unless ($lease =~ /Telephone/); print $lease; }
Hope this helps - L~Rwhile (defined (my $lease = <LEASE>)) { next unless ($lease =~ /Telephone/); foreach my $line (split /\n/ , $lease) { # Do something with the line? print $line, "\n"; } }
PS Telephone could be replaced by just about any piece of information in the lease that you want to search for
|
|---|