in reply to Concatenating text for a hash problem
your first problem is that you don't test to see if the regex matches, because you want to treat lines differently (> lines become hash keys, lines after then become their data). the next two lines make no sense, you append every $_ to $str but never clear it. at the end of the loop it will contain a concatenated copy of every line of data post-chomp.
i'm not going to post working code because this is very basic logic; i'm guessing you were given an assignment to do this and got frustrated. throw an if (/regex/) { this is a key } else { this is a data line } and you'll start going somewhere
perl -e"\$_=qq/nwdd\x7F^n\x7Flm{{llql0}qs\x14/;s/./chr(ord$&^30)/ge;print"
|
|---|