in reply to Chomping Lines, Storing as Hash, and Printing "keys" from Hash

What steps have you taken to isolate the problem?

Is the recursive parsing of the directory and the writing to FILE relevant to the problem?

Have you printed out the progress of your program and inspected whether it processes all the subfiles you want it to process?

Have you printed out the progress of your program and inspected whether it processes all the 4-digit sequences?

Have you inspected how your program outputs the data it has collected? Does the program output the correct information if you hardcode data into %data instead of collecting it from files?

If you work through these steps, either you find a solution or you get your program to a state where you can ask better questions by describing how your program behaves and what you expect and where the differences are between the expected behaviour and the observed behaviour.

Replies are listed 'Best First'.
Re^2: Chomping Lines, Storing as Hash, and Printing "keys" from Hash
by editholla (Initiate) on Jan 06, 2016 at 17:17 UTC

    Corion,

    My bad, Corion. I am in my second week of Perl (and mostly programming as a whole) and I am struggling. Let me try to explain in more detail.

    **UPDATE**:

    I figured it all out. Thank you, Corian. After you reminded me to step through my process, I ended up figuring out the solution on my own.

      Take a look at here-doc in Quote and Quote like Operators

      #!perl use strict; my %data = ( 11111=>1,22222=>2 ); open FILEPNP,'>','zzzzz.tmp' or die "$!"; for my $k (keys %data){ print FILEPNP <<EOF; <div> <a href="/$k.html">$k</a> </div> EOF }
      poj
      After you reminded me to step through my process, I ended up figuring out the solution on my own.
      Very good, you've just learned something that will be very useful to you many many times, perhaps even during an entire life of a programmer. :)