#! /usr/bin/perl use strict; use warnings;print "\n----------------------------------simple_pattern_Metacharacter_quantifier--------------------------\n";$_ = "asteriskasterisk hash access unpack_func";for (/as.*e/){ print "matched.\n";}for (/(asterisk)+/){ print "matched*2.\n";}for(/unpack.*|lvalue|alignment/){ print "matched*3.\n";}my @escaped = "asteriskasterisk hash access unpack_func";print @escaped;print "@escaped";foreach(@escaped){ print $_;}print "\n";print $escaped[0];print "\n";unless( $escaped[1] ){ print "\$escaped[1] is undef.";}print "\n----------------------------------simple_pattern_Metacharacter_quantifier--------------------------\n";print "\n----------------------------------_alternative_--------------------------\n";print $_."\n";for(/access (unpack|indices)_func/){ print "matched*4.\n";}print "\n----------------------------------_alternative_--------------------------\n";print "\n----------------------------------_character_class--------------------------\n";$_ = ‘z‘;for(/[a-cw-z]/){ print "matched*5.\n"; print "\000"; print "\n"; print "\177";}$_ = "The HAL-9000 requires 8 authorization.";if(/HAL-[0-9]+/){ print "HAL computers mentioned."}print "\n----------------------------------_character_class--------------------------\n";print "\n----------------------------------_character_class_shortcut--------------------------\n";if(/HAL-\d+/){ print "HAL computers mentioned. matched*5.\n";}if(/requires \w authorization/){ print "matched*6.\n";}print "\n----------------------------------_character_class_shortcut--------------------------\n";print "\n----------------------------------exercise_ch7_--------------------------\n";$_ = "aligning Alignrick or veralign.";if(/align/){ print "matched*7.\n";}open ARROW_NOTATION,"< file_4_ex_ch7.txt";my $counter = 8;while(<ARROW_NOTATION>){ chomp; my $arraow_Syntax = $_; #for(/[a|A]lign/){ for(/\./){ print "matched*$counter.\n"; $counter++; print $arraow_Syntax."\n"; }}close ARROW_NOTATION;print "\n----------------------------------exercise_ch7_--------------------------\n";print "\n----------------------------------exercise_ch7_4--------------------------\n";while(<>){ if(/[A-Z][a-z]+/){ print $_."\n" ; } if(/[a-z][A-Z]/){ print $_."\n" ; }}print "\n----------------------------------exercise_ch7_4--------------------------\n";