#!/bin/perl -w use strict; use warnings; my ($filename, $lineOfCode); open (FH, "filename.txt")|| die "could not open filename.txt"; while (<FH>){ if (m/^(\d+)\s/){ $lineOfCode = $1; } if (m/\/(\w+\.?\w*)$/){ $filename = $1; } }
If there are many lines that you wish to save then you'll have to use an array instead for $filename and $lineOfCode.
Neil Watson
watson-wilson.ca
In reply to Re: parse
by neilwatson
in thread simple parse question
by Sara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |