# [Perl 5], 283 bytes <!-- language-all: lang-perl --> $s=<>;@m{split/ /,<>}='a'..'z';for$o(map ord,split//,unpack'u','MZFILEI<EN7);<>06[9:E);TQXKJ-\QHUJA8*WZK\R)HH6"V<NUVA9^C*9.JNM,9TNI^S(RA8*B+:UM_54C-,L.JJ_Y57A8*4C&3J_F%C)1U"GJOY/J:*YLI.J=8>QLEL,>C(6"[+5C.Z"HD["J_,B:*%@NOJI78K``'){$s=~s,..{$_},,+print$m{$&}for map{($o>>$_)%4}6,4,2,0} [Try it online!][TIO-k4nebsec] [Perl 5]: https://www.perl.org/ [TIO-k4nebsec]: https://tio.run/##pVRZc9pADH7vr/AwJsawEmnLfXiSuKSwHBnSkBbIxGF6zGQaAgPJSz30r1Ov7d3VQt7qC62klfR90rL@uXkq7/f2tt3ymmfLcLt@enwpWkXW8nZtZ@EgOn@c5q/Vxl7llou1tdr8YIlPkb0@rxfffzuvDnOGs8veoNNrdUZVt9nyTivzeqPjNm/G3/oc7sbdCT@v5b/O@nfXbrdbydy2RpPb8/q9n68jHw1Z/WbUu/@Su46cLgqNyTAol3xgA@Q8mJarkbbkn3zkwWXWd99PMp/51bTIG/npoIe8XfPGg86AeX6ukpkXyj7OMt1P8wwP2EUjnz0bXfFetdZ/eHDcMEL5d8sQQzvYMVZYbx6fX@xlaJ/sIoBWBC/M2SvPswM3W9pVWIl9YKe7/R4QxIXRT/Ikb7RGeaXGRBVLQLUIoFemBdNdIO84FahwibdKp7Kkbgep00/qnsYH5Z7CQOOj9ko7yQBmXFWxNKgAGiVBrClS3qCiHURMC9BGkLBlBMo8oY@wpkrVZaZNk7gNAtCoAFT5KGGQErVJU0WhmVBUHUaTNMgj/tHolGaE4FWZQEGiE3dIvNE@NXpw3Mi3MoKWQO4kfKtiAamKzi2QOGCcgqMyNX@6Oxo3knrIVIGuDQhtig/dPSTb5HybWg0HKMSD82mcKT2AlEjaRD0xQDCS2fy/42LOMuo5xzf/n@QkCss7BEtYLLEUkhXdsQhCEOvoifyFgyWCWLFsCZVIIxxjgxVHEZuFFBtFvHgjCC/8Bw "Perl 5 – Try It Online" Which is the same as this without comments, newlines and spaces: $s=<>; @m{split/ /,<>}='a'..'z'; for $o ( map ord, #convert bytes to ascii numbers split//, #split into bytes unpack'u', #base64-decode string on next line 'MZFILEI<EN7);<>06[9:E);TQXKJ-\QHUJA8*WZK\R)HH6"V<NUVA9^C*9.JNM,9TNI^S(RA8*B+:UM_54C-,L.JJ_Y57A8*4C&3J_F%C)1U"GJOY/J:*YLI.J=8>QLEL,>C(6"[+5C.Z"HD["J_,B:*%@NOJI78K``' ){ $s=~s,..{$_},, + print$m{$&} #match and print one char + length-1 from input for map {($o>>$_)%4} 6,4,2,0 #convert 0-255 to four 2-bit numbers (or lenghts - 1) } Input is these two lines on stdin: * the long dot-dash-string and * the morse code for each letter a-z separated by space This answer is similar to the python3 answer from @steviestickman except it uses base64 instead of hex code (which is base16 sort of) since base64-decoding is a perl built-in using `unpack`.