Except perhaps for purposes of enhanced readability/maintainability, is the explicit stringification ever needed? Doesn't  ne or any other stringwise comparator implicitly stringify everything it operates on, including references (but with due deference to undef)? (Granted, stringifiying a reference for comparison purposes is usually useless, but that's another discussion.)

c:\@Work\Perl\monks>perl -wMstrict -le "use warnings; use strict; ;; use Data::Dump qw(dd); ;; my @stuff = ('abc', 123, 'ab4', '123', 456, [ 123 ], { 123 => 'x', x +=> 123 }); ;; my $thing = 123; my @filtered = grep { $thing ne $_ } @stuff; dd \@filtered; ;; $thing = '123'; @filtered = grep { $thing ne $_ } @stuff; dd \@filtered; " ["abc", "ab4", 456, [123], { 123 => "x", x => 123 }] ["abc", "ab4", 456, [123], { 123 => "x", x => 123 }]

OT: I sometimes see what one might call "super stringification" in code that often seems to originate from biological users, e.g.:
    my $filename = '...';
    open my $fh, '<', "$filename" or die "...";
Can anyone comment on the origin or history of this apparent (mis-)meme?

OT: Update: The other odd idiomatic usage I see that seems to be of biological origin is along the lines of:
    my $fh;
    unless (open $fh, ...) {
        print "open failed...";
        exit;
        }
Huh?!?   Are BioMonks constitutionally averse to die-ing? Is it that  exit; is needed to return a non-error exit code to the OS?


Give a man a fish:  <%-{-{-{-<


In reply to Re^2: Filtering array of strings and numbers by AnomalousMonk
in thread Filtering array of strings and numbers by nysus

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.