in reply to reading a value from a given text

my $string = 'O1/APZ "GWHMSC2_R132_EP" 3233 150407 1448 BACKUP INFORMA +TION FAULT FAULT CODE 34'; my $thirty_four = substr($string, 18, 1) . substr($string, 33, 1); my $flag = (34 == $thirty_four);

Or did you have a different way of extracting "34" from the string?

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: reading a value from a given text
by karlgoethebier (Abbot) on Apr 07, 2015 at 19:29 UTC
    "...a different way of extracting "34"...

    my $flag = grep { /(34)$/ } split / /, $string;

    Update: I regret this crap. Had a bad day, or and it is to too late, sorry.

    Update 2: my $flag = ( ( split / /, $string )[-1] == 34 );

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»