Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
  1. Seldomly when using a she-bang line (-T being an exception, and for quick and dirty hacking, -s), but from the command-line: -w, -p, -n, -a, -i, -l, -e, -0, -c, -D, -v, -V, -I, -M, -x belong to my favourites. Do I have the time to explain all of them?
  2. use strict is not a command - it's a statement. It compiles the strict.pm module, and calls the import sub in it. This will twiddle some bits in $^H, which causes the compiler to check for certain things, and complain if the conditions aren't met. I don't know whether I should use it, but I can explain why I often do use it. (insert strictness mantra).
  3. It depends a little on the context. It could mean the following variable are scalars, arrays or hashes, but it could also mean that the following expression is used as a scalar, list, array or hash.
  4. All of them. But perhaps "whitespace" is the most important for readability (and hence, reusability). Although, technically, "whitespace" would mean the absence of any element of the Perl language.
  5. I believe that "suitable language" is more defined by the programmers going to do the project than the project itself most of the time, so my answer would be "if the programmers are Perl programmers".
  1. Because I happen to know it, and it often satisfies my needs.
  2. my declares a lexical variable (or a set of lexical variables), local creates a new (or a set of new) value for a non-lexical variable (which is not the same as a package variable).
  3. use is done at compile time, calls import if applicable, and can only be given a bare word as first argument. require is done at run-time, takes an expression (or a version) as argument, and doesn't call import.
  4. It depends on what I want to do.
  5. A mapping that maps strings to arbitrary scalars.
  6. IP addresses? In which format? Dotted quads? Hex? 32 bit integers? IPv4? IPv6? There are no simple regexes for e-mail addresses, unless you either wants lots of false positives, false negatives, or both. City-state-zipcode of which country? US? If so, what format zip codes? 5 digits? 5+4? Either? As for states, 2 letter states? 3 letter states? 2 or 3 letter states? Do you expect your programmers to remember all 50 abbreviations? There are a few extra areas that have "state codes" as well? Am I supposed to know them?
  7. -w tests whether a file (or filehandle) is writeable for the EUID, -T guesses if a file (or filehandle) is an ASCII file, and strict is a bare word that "use strict;" wouldn't approve off.
  8. There's no difference between for and foreach. And system does a fork, execs in the child, waits in the parent.
  9. The manual has all I need.
  10. You see, I wanted to write this program ....
  11. It depends. There's 2-arg open, 3-arg open, sysopen (either of which can be used with a filehandle, or a reference to a filehandle as first argument, and Perl will happely autovivify an undefined value into a reference to a filehandle for you as well), and modules like IO::File, IO::All, and Inline::Files. I typically use 2-arg open, 3-arg open and sometimes sysopen. All three with references to filehandles (usually autovivified handles) as first argument. Filehandles as first argument is asking for trouble.
  12. _A_ character in a string? As in, a single one? Say, the third character? substr($str, 2, 1, "x") if length($str) >= 3;
  13. Well, that would be either 0 or 1, and it will be 1 if, and only if, the string originally was at least 3 characters long.
  14. If the other programmers don't know Perl. If speed is crucial. If the target environment has limited resources (memory, disk, CPU). If the source cannot be distributed. If deployment is going to be a problem. If portability demands it. If it needs to run in an environment perl doesn't run in, or can't be installed into. If the customer demands a .NET solution. If there's a domain specific language far more suitable for the problem than a generic language like Perl. If low level memory access is a major part of the solution. If the moon is blue. If I feel like using Java for today. If it's better done using a Makefile.

In reply to Re: Interview Prepration by Anonymous Monk
in thread Interview Prepration by Anonymous Monk

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (3)
    As of 2020-10-24 01:32 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My favourite web site is:












      Results (242 votes). Check out past polls.

      Notices?