The first statement creates a hash variable and assigns a group of keys and values to it. The second statement assigns a value to the scalar variable $pixel. The third statement assigns a value to the scalar variable $url_file, concatenating two string values and the value of $pixel. The fourth statement assigns a value to the scalar variable $file, again concatenating two bits of text with the value of $pixel.

The fifth statement is the most complicated one. It says, "if the file named in $file exists, unlink (delete) the file or exit the program and tell me the most recent error." Using or in this way is an idiomatic way in Perl to say, "do this, and if it fails, do that." So if the unlink succeeds, the or is satisfied and the die is not executed. To rewrite it longhand to make the order of things clearer:

if( -e $file ){ unless( unlink $file ){ die $!; } }

Aaron B.
Available for small or large Perl jobs; see my home node.


In reply to Re: QUERY ABOUT A SECTION OF A CODE by aaron_baugher
in thread QUERY ABOUT A SECTION OF A CODE by majo

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.