#!/usr/local/bin/perl -w use strict; use warnings; print "Enter the output file you would like to analyze: "; chomp (my $filename = ); print "Enter the isotope you want to extract (ex: Am-241): "; chomp (my $iso= ); open(IN, "<", $filename) or die("Can't read the source:$!"); open(OUT, ">Comp_$filename"); select (OUT); $/ = '0AVERAGE COMPOSITION IN PINS.'; while () { next if ! /$iso/; chomp; print "$/$_"; }