Hello PitifulProgrammer,

Here’s some feedback on your annotations:

use Data::Dump qw/ dd /; # Creates a shortcut for calling Data::Dumper, writing dd is enough to + call module

Say rather, writing dd is now enough to call Data::Dump::dd. But actually qw/ dd / is not needed here, because the Data::Dump module exports dd by default.

Main( @ARGV ); # main function, takes every file (as an argument) that is passed to @ +ARGV, might be command line or files #that are read in

Correct, but note that in Perl, unlike in C, you don’t need a main function. (I assume that by “command line” you mean command line options.)

exit( 0 ); #not really a clue, maybe main exits if no arguments are passed to it

No, exit terminates the script and returns its argument to the shell. By convention, an exit value of zero means “success: the script terminated without errors.”

dd( -argv, \@ARGV ); #calls Data::Dumper via reference => possibly to print which files are + being passed as arguments (control function)

No, dd is a Data::Dump function; Data::Dumper is a different module.

Sky(6); #not really a clue => Does that mean that the sub stops after six runs

No, it’s just another call to sub Sky with the literal 6 passed as an argument instead of the variable $ar.

my( $ra ) = @_; # variable for the argument(s) passed to the sub, @_ accepts every + argument passed to sub, i.e. the files passed to main

Yes, but note that only the first of these arguments is being copied to the scalar variable $ra. (All the arguments passed to the sub remain in the array @_.)

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re^8: search and replace strings in different files in a directory (Path::Tiny) by Athanasius
in thread search and replace strings in different files in a directory by PitifulProgrammer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.