#!/usr/bin/perl use strict; use warnings; while () { last if /AGF30/; } exit unless defined; unless (/%/) { while () { last if /%/; } } exit unless defined; my $ir_value = substr $_ => -10; for my $c (1 .. 2) { no warnings 'misc'; $_ = err exit; } my $ysp_value = substr $_ => -10; print "\$ir_value = $ir_value"; print "\$ysp_value = $ysp_value"; __DATA__ one line two line three line bla AGF30 foor four line feeble % 0123456789 one more two more ABCDEFGHIJ end #### $ir_value = 123456789 $ysp_value = BCDEFGHIJ