
March 23rd, 2000, 05:33 PM
|
|
Contributing User
|
|
Join Date: Aug 1999
Posts: 119
Time spent in forums: 1 m 41 sec
Reputation Power: 14
|
|
|
to open a file, just use the open function (perldoc -f open).
the easiest way to get the contents of that is to use read (perldoc -f read).
then, once you've done that, it's a matter of using regular expressions. Those are a bit more difficult to understand, but try "man perlre".
Here's an example of one that you may be able to use, haven't tested it and my skills at REs are not mastered (understatement).
# contents of file in $c
if ( $c =~ m|<x>([^</x>]*)</x>|im ) {
$d = $1;
}
# now $d has everything b/w <x> and </x>
I don't have time to look and see if '<' and '>' are special characters, but I don't think they are.
I'm sure someone will correct me if this is wrong...
good luck.
|