Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Meditations

( #480=superdoc: print w/replies, xml ) Need Help??

If you've discovered something amazing about Perl that you just need to share with everyone, this is the right place.

This section is also used for non-question discussions about Perl, and for any discussions that are not specifically programming related. For example, if you want to share or discuss opinions on hacker culture, the job market, or Perl 6 development, this is the place. (Note, however, that discussions about the PerlMonks web site belong in PerlMonks Discussion.)

Meditations is sometimes used as a sounding-board — a place to post initial drafts of perl tutorials, code modules, book reviews, articles, quizzes, etc. — so that the author can benefit from the collective insight of the monks before publishing the finished item to its proper place (be it Tutorials, Cool Uses for Perl, Reviews, or whatever). If you do this, it is generally considered appropriate to prefix your node title with "RFC:" (for "request for comments").

User Meditations
Language design: direct attribute access and postponed mutators (Perl Vs Python)
5 direct replies — Read more / Contribute
by LanX
on Sep 15, 2019 at 13:42
    Dear monastery,

    In my never ending desire to study different language designs I had a closer look into Python's OO model ...

    ... and I was very surprised to see that there attributes are accessed directly.

    object.attribute = 10

    is very common "pythonic" code.

    Doing something like object->{attribute}=10 is not only very uncommon in Perl but also heavily frowned upon.

    This is only partly because Perl's inner implementation is not necessarily a blessed hash and because in Perl methods and attributes have separated namespaces. (In python much like JS they are inside the same hash)

    The main issue is that at the moment of object design you can't know how the nature of getting and setting attributes may evolve in the future...

    ... for instance you may later want to restrict allowed values to a range of values and the setter to act like a guard which can potentially report errors.

    Could it be that the python community is totally ignorant of this issue?

    Seems not, for this case they reserve a backdoor mechanism called property where a simple attribute value is replaced by another object with dedicated get, set, delete accessors. And to facilitate using it they provide a @property decorator as syntactic sugar. "@Decorators" are the python equivalent of ":attributes" (For deeper insights please see this SO discussion)

    This reminds me a lot to the :lvalue technique once discussed for Perl.

    We can easily define a getter mechanism for a attribute with

    sub attribute :lvalue { return $value }

    And returning a tied value could be used to extend it with a proper setter.

    sub attribute :lvalue { return $tied_value }

    This help provide a object->attribute = 10 interface, were the Store and Fetch of the tied value would act as getter and setters.

    I remember seeing this discussed by Damian - not sure if here or in his OO book.

    IIRC he dismissed this technique for being to slow.

    Questions:

    • Could it be possible that the python solution is much faster?
    • If yes why?
    • are there better options in Perl to upgrade the easier interface?
    • Update: is Variable::Magic an option?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

    PS: this is a meditation seeking for insights... fanboys please spare me with "just use moose propaganda", I'll ignore it.

The wave of unfamiliarness
No replies — Read more | Post response
by stevieb
on Sep 09, 2019 at 16:03

    I would like to apologize to all of my fellow Monks, friends, newbies and others here on Perlmonks.

    I've been on a severe roller coaster over the past few years, and it seems things have just kept up pressing without much of a break. Recently, I've been belligerent, argumentative, evasive and just not in-tune with how I normally behave.

    This is my favourite place on the Internet, and it has been for many years.

    I've been lacking in my responsiveness and dedication, and I'm not going to hide behind excuses. I am sorry if I've offended anyone.

    Apparently, last month I hit 10 years of having an actual account. Before that, I was here lurking for nine years or so.

    I love this place, and have much more to bring forth, while I continue to learn as I always have.

    Your patience has been welcoming, and I appreciate all of the kind feedback as always.

    I'm hoping, within a week or so, to get published here my dedicated Raspberry Pi test platform that also contains certain security monitoring aspects for my home. I know some have been interested in security systems, so I decided to use my hardware CI platform to monitor some windows, doors, laser trip wires and PIRs that send me photos/videos via text if any are breached so that I could test my OLED display software, serial and I2C modules, and other things that are now so common to me they may as well be within my dedicated Unit Test Suite.

    I also have a few other things up my sleeve, but I've got about a month of going through my bugs/issues to get as many out of the way as possible before I begin another weird venture.

    Cheers all, and thanks.

    -stevieb

RFC: new module WebService::Discord::Webhook
1 direct reply — Read more / Contribute
by hornpipe2
on Sep 03, 2019 at 12:34
    I originally posted this to Reddit, which directed me here.

    First, the Github link: https://github.com/greg-kennedy/p5-WebService-Discord-Webhook

    The Discord chat service allows server ops to create "webhook"s for their server. These are special secret URLs that allow an external client to post notifications into chat by making certain HTTP requests.

    (For those unfamiliar with Discord, think "Slack, if it chugged a 12 pack of Mountain Dew".)

    I created this Perl module as a way to help interact with Discord webhooks. The various functions of Webhooks are wrapped in Perl functions that execute with HTTP::Tiny, and data structures with JSON::PP. I tried to focus on ease of use and documentation.

    I would appreciate it if anyone could provide feedback or check the code and see if it looks sensible. I do plan to submit this to CPAN and it would be my first module there, so I want to make sure I get it right!

    EDIT: also on PrePAN now: http://prepan.org/module/nYmTLYacoXW

    EDIT2: Nobody had complaints except the names... no news is good news, I guess. It's on CPAN now.

Fun with implicit type conversions
3 direct replies — Read more / Contribute
by haj
on Aug 29, 2019 at 11:34
    Recently, jdporter closed one of his comments with the following snippet: $orry - not $orry

    This is a valid Perl expression. So, I wondered, what is its value? My first thought was "easy: that's just $orry converted to a number", but as ever so often, my first thought is wrong. If $orry = 0, then the value is -1. If $orry is a string, then the value is 0. Unless the string is empty, in which case the value is -1. And unless the string starts with a number, where the result is that number, even if the number is 0. And then, there are references, typeglobs, tied scalars, and objects, which may even overload stuff.

    Here's a collection of expressions for $orry, and results of $orry - not $orry.

    $orry : $orry - not $orry 42 : 42 -1 : -1 0 : -1 undef : -1 "" : -1 0e0 : -1 "0e0" : 0 "a123" : 0 "-.2e2e" : -20 "nancy boy" : NaN "infidelity" : Inf *STDOUT : 0 [] : 94269931603432 File::Temp->new : 94269935380840 URI->new(q(https://perl.org/)) : 0

    The implicit conversions of scalars into numeric / boolean / string context are amazing, and sometimes scary. Fortunately, use warnings; detects most of the surprising ones.

    Update:: syphilis contributed the strings "nancy boy" and "infidelity" which are indeed amusing additions. I inserted them after the strings starting with numbers. In the case of 'nancy boy' my text "string starts with a number" looks silly because NaN claims to be not a number.

Help with my crap
5 direct replies — Read more / Contribute
by stevieb
on Aug 22, 2019 at 20:59

    Esteemed Monks and fellow travelers,

    I'm in a position where I've got a tad bit too much to handle, so I'm putting out a request.

    For years, I've supported Perl in ways that nearly defied logic relative to my real life. Came from nothing, did something, blah blah blah.

    Many have done that. What I appreciate is the attentive use and comprehensive addition to Perl that so many Monks and others have contributed to my favourite language over the last near-20-years.

    Now, I'm not as dynamic. I'm not as fluid and liquid to bounce from one thing to the other by the minute. I can't maintain my library of software myself anymore.

    For that, and for many other reasons, I'm hoping to liquidate or at least get help with some of my Open Source Software projects.

    I'm STEVEB on the CPAN, and my repo stash is here. Take a look and let me know if there's anything you'd like to grab or take part in.

    berrybrew, as well as a few CPAN dists I favour I'd like to oversee, but mostly, take a look and let me know if you want to overtake anything.

    License retention, DVCS experience (repos stay in a freely-available and accessible location), and a proven love for Perl are absolute requirements. I put my love into what I've done. I would hope someone would take my silly code and keep it something that's usable.

    One last statement... don't take job offers seriously without doing extreme and exceptional due diligence. I got fucked up the ass while I had head injuries. Sickening, yep, fucking angering, yep, don't accept any job if you don't get paid in advance. This world is a different place anymore. I am just too tired to be raped without appreciation.

    Street-smart linguistic troublemaker who didn't see a fabricated theft coming right at him. I'm ashamed.

    -stevieb

Truth and Falsehood
3 direct replies — Read more / Contribute
by haukex
on Aug 17, 2019 at 05:19

    Truth and Falsehood

    In Perl, the following values are false in boolean context:

    • The number zero (0)
    • The string "0"
    • The empty string ""
    • undef

    All other values are true.

    Boolean context is a scalar context. Therefore the following things, when evaluated in boolean/scalar context, are also false:

    • An empty array, which evaluates to the number of elements it contains, i.e. zero (0).
    • An empty hash, which evaluates to a false value when it is empty.
    • The empty list (), which evaluates to undef.

    A true value negated by ! or not, plus many of Perl's builtins/operators, return a special false value: When evaluated as a string it is treated as "", but as a number, it is treated as 0, without causing any warnings.

    When the Perl documentation says that a operator or function returns "a false value" or "a true value" (or more simply, "false" or "true"), it may return any of the above values.

What modules should be added to the corelist?
7 direct replies — Read more / Contribute
by Anonymous Monk
on Aug 16, 2019 at 09:17
Refactoring example (A good one? (Perl6))
1 direct reply — Read more / Contribute
by holli
on Aug 10, 2019 at 17:45
    Allright, so I am hacking on a module that needs to load plugins. There is the Pluggable-module which attempts to do that. But I needed additional functionality like being able to get a list of plugins without loading them, and load a list of plugins I give it. And so I looked at the code and found it to be deeply entangled in two big functions, which somehow included already what I needed. So instead of c&p the pieces I needed into new code, I ended up refactoring the whole thing.

    The thing with refactoring and staying DRY is, that it is often hard to judge where to stop tearing the functionality into smaller and smaller components. At some point, oversight is lost. That idea was reinforced by some talk I watched this week and so I am asking myself wether my judgement in this matter is as good as I think it is.

    Long story short, here are the original version and the refactored version. Keep in mind the refactored version has a greater functionality. Did I do a good job? Which version would you want to add to? Which version would you rather look for a bug in?

    Original:
    Mine:


    holli

    You can lead your users to water, but alas, you cannot drown them.
Teen Perl
1 direct reply — Read more / Contribute
by Anonymous Monk
on Aug 09, 2019 at 03:14
    Will Braswell talks about "the Perl 11 Master Plan to make Perl the king of languages again" in the "State of the Scallion Address" at The Perl Conference 2019 in Pittsburgh. Step 1 of the plan: "We're going to have to educate young people". Perl has this hidden gem of a tutorial which was originally a multi-page website titled "Tinkering With Perl: A Child's Guide" that survives as a single webpage (without the enchanting subtitle) at https://cjshayward.com/perl/

    Will Braswell - "The State of the Scallion Address"
    https://www.youtube.com/watch?v=NyphRo5roV0

    The Perl 11 Master Plan
    https://www.youtube.com/watch?v=NyphRo5roV0&t=27m20s

RFC: Concise OOP Syntax
1 direct reply — Read more / Contribute
by LanX
on Aug 04, 2019 at 20:59
    Dear monastery!

    In continuation to

    I tried to hack a proof of concept for a concise OO syntax

    The basic ideas are that:

    Declaration of instance variable
    • my on the class level with :attributes
    • the TYPE is given right after the my
    • attributes reflect the Moo(se-)model of has keys where possible
    • the assigned values are defaults for the new-constructor
    Access of instance variables inside methods
    • an instance variable x is readable and writable via $$x
    • this is automatically mirrored in $self->{x}
    • $self->{x} is an alternative syntax for the same access
    $self
    • $self is already shifted from @_ and directly available
    Methods
    • all subs declared inside the scope of a class are methods
    • imported subs (like pp) are ignored

    { use Class BLA => ISA-LIST; use Data::Dump qw/pp/; my Int ($x,$y) :has :rw = (10,11); sub set_x { my ($var) = @_; #warn "set_x $$x -> $var \n"; $$x = $var; } sub print_x { print "x = $$x \n"; } sub print_self_x { print "x = $self->{x} (via \$self)\n"; } sub dump { warn '$self:',\$self; warn pp '$self: ', $self; warn pp '$$x: ', $$x; warn pp '$$y: ', $$y; } }

    The implementation is done via a macro expansion from use Class which injects some boilerplate into the head of the class, which handles the creation.

    Injecting is basically done via a source filter or alternatively via Keyword::Simple. NB: just injecting some code doing introspection. No parsing, regexing or modification of the code you see.

    I'm supposing this concise syntax could be used as a front end for all current OO models in Perl and might help offering a stable backwards compatible syntax if it's hardcoded into the engine.

    A rough proof of concept follows here:

    NB: This example is pretty barebone, and not meant to be an alternative to other OO Frameworks, but rather a frontend. It doesn't create accessors and the constructor is only simplistic.

    Comments?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

parent::versioned supports minimum version specification in parent classes
3 direct replies — Read more / Contribute
by davido
on Aug 04, 2019 at 14:58

    A question came up here recently where a user wished to specify a minimum version for a parent class. base doesn't support specifying minimum versions, nor does parent. base and parent are core Perl modules. I don't think it would be appropriate to add complexity to the core Perl parent by adding this feature.

    Perl facilitates setting minimum versions in use statements:

    use Time::HiRes 1.9;

    use has a compiletime effect, so that code behaves like this:

    BEGIN { require Time::HiRes; Time::HiRes->VERSION(1.9) Time::HiRes->import }

    However, BEGIN blocks require us to consider the order of loading more than we may want to. This doesn't fit the model of keeping simple things simple, if the simple thing we want to do is fairly common.

    For inheritance we can do this:

    package MyAgent; BEGIN { require LWP::Usergent; LWP::UserAgent->VERSION(6.39); # Assert a minimal version. push @MyAgent::ISA, 'LWP::UserAgent'; }

    To me that's too much boilerplate for a common need. Another way:

    package MyAgent; use parent 'LWP::UserAgent'; BEGIN {LWP::UserAgent->VERSION(6.39)}

    But that's a little fragile; someone may refactor and forget to keep the BEGIN block after the call to parent causing things blow up. Sometimes code becomes complex, masking simple mistakes. I would prefer a solution that doesn't require the user to maintain several steps to set up inheritance while assuring minimal versions for parent classes.

    parent::versioned makes the inheritance and compile-time version checking more convenient, and harder to get wrong. I uploaded it to CPAN a few hours ago.

    package Myagent; use parent::versioned ['LWP::UserAgent' => 6.39];

    parent and parent::versioned behave the same for all import lists unless an element in the import list is an array ref. Any array ref passed to the import list will be treated as a tuple that specifies a module name, and a minimum version for that module. Multiple inheritance works like this:

    use parent::versioned ['LWP::UserAgent' => 6.39], ['Mojo::DOM' => 7.2 ], 'Foo::Base';

    This example sets up triple inheritance: two modules that are version checked, and one that is not. As with parent, parent::versioned accepts the -norequire flag.

    The parent module has 100% code test coverage. parent::versioned passes the parent test suite and maintains 100% coverage. It should work as a drop-in replacement for parent, but with the additional functionality exposed by passing an array-ref as part (or all) of the import list. Most of the code is a direct fork from parent. You can use it just like you use parent:

    use parent::versioned qw(Foo);

    I prefer keeping the module small, but if you're interested please do look at the GitHub repository. Patches, issues, and suggestions are welcomed. I hope it becomes useful.


    Dave

Hashes do preserve insertion order after all
5 direct replies — Read more / Contribute
by kikuchiyo
on Jul 31, 2019 at 12:00

    It is often repeated that hashes in Perl do not preserve insertion order. Yet:

    #!/usr/bin/perl use strict; use warnings; use feature qw/say/; my %hoh = ( foo => { value => 'first' }, bar => { value => 'second' }, baz => { value => 'third' }, ); for my $elem (sort values %hoh) { say "value => " . $elem->{value}; }

    Output:

    value => first value => second value => third

    Edit and clarification: I'm not saying that you should ever use this (in fact, I'm saying that you shouldn't, the comments below describe why). It looks like as if it really preserved insertion order, but actually the trick relies on implementation details (memory allocation) you can't (or shouldn't want to) control.

Thx, St. Larry, for the Beauty of Sigils
4 direct replies — Read more / Contribute
by msouth
on Jul 26, 2019 at 13:12
    TL;DR Thanks, Larry, for sigils

    I recently took a job at a Python shop, helping out a friend. I have tried to be patient with the new-to-me language and to realize that there are different ways of doing things and that I should expect some mental friction simply due to my unfamiliarity. But, man, I just can't escape the idea that sigils were a good idea.

    I needed to access a dynamically specified method and run a dynamically specified method against that method's result. Python can't tell the difference between a variable you created that contains a method name and a method name itself. You have to use a function called getattr to cumbersomely retrieve the reference you want. And if you go any deeper than one, it gets ugly very quickly. In my case, I have something like

    getattr(getattr(object_identifier,variable_containing_the_name_of_meth +od_one), variable_containing_the_name_of_method_two)

    (I'm using ridiculously long variable names for clarity about what the variables contain.)

    With sigils to let Perl know that I mean 'grab the contents of the variable and execute the method having that name', I can do:

    $object_identifier->$variable_containing_the_name_of_method_one->$obje +ct_containing_the_name_of_method_two

    With the ridiculous names it may be less clear how much nicer this is, but look at:

    $obj->$var1->$var2

    vs

    gettattr( getattr(obj,var1) , var2)

    I hate going to the inside and working my way out, trying to remember what I picked up along the way.

    I realize that Python people hate having to type sigils all over the place, and that they would find it ironic that this would be the thing I would write in praise of. But I am doing a lot of work right now with dynamic method/attribute names and it really seems to me that Larry made the right call on this.

response to "The Perl Community - a mixed bag of sometimes intollerance and sometimes fantastic help"
4 direct replies — Read more / Contribute
by daxim
on Jul 24, 2019 at 03:19
    mje says he was ridiculed and alludes to intolerance (in the heading):
    GIven my new enthusiasm for the Perl community I dare to post an issue I was having to IRC on #perl-help and it all fell down. [] anyone posting in #perl-help, needs help and I'd forgotten that certain people view this channel as a shooting ground where you pour ridicule on posters "who don't understand their problem" - of course they don't or why would they post on #perl-help. I got some helpful comments but I also got the ridicule.
    That sounds untypical for #perl-help, in which I occasionally participate on both the Q and A sides. (There's my disclosure of bias.) mje did not substantiate, so I went and looked what happened. I did not find ridicule, not even a heated discussion. I notice I am confused.

    I decided to post the log because the Perl community as a whole was blamed, not individuals, and in order to provide accurate first-hand information so that anyone can form their own opinion.

    2019-07-23 18:47:42 mje__ I have a strange warning that I cannot + provide a runnable example for. The code "if (defined($match->{in_co +ntrol}) && ($match->{in_control} == 1))" ends up issuing a warning sa +ying "Use of uninitialized value in numeric eq (==)" but I cannor und +erstand how this can happen. $match is defined and even if it wasn't +I'd expect a warning saying trying to deref and undef. I don't think +it is autovivification as my tests show 2019-07-23 18:47:42 mje__ defined doesn't do this. Any ideas? 2019-07-23 18:48:44 mje__ Perl 5.24.4 2019-07-23 18:56:48 alh in_control could have operator overloa +ding 2019-07-23 18:57:00 alh Alternatively, the warning isn't happe +ning where you think it is which seems more likely 2019-07-23 18:57:21 alh Line numbers can be wrong if it's part + of a giant if () { } elsif () { } else {} block 2019-07-23 18:57:35 alh So it could be a different conditional + triggering it 2019-07-23 18:58:54 mje__ Simple hash ref, so no overloading. Th +e warning seems pretty good since the line mentioned contains an == 2019-07-23 18:59:58 alh Is it part of a multi-line conditional +? 2019-07-23 19:00:02 alh Can you show us more of the code 2019-07-23 19:00:08 mst the warning is happening somewhere els +e 2019-07-23 19:00:10 mst 99% chance 2019-07-23 19:02:28 mje__ Here is what it looks like now https:/ +/pastebin.com/fsTnLRaS, the only thing changed from when the warning +was output was defined changed to exists 2019-07-23 19:02:29 Repaster Repasted text from mje__: http +://perl.bot/p/mmydbc 2019-07-23 19:03:03 alh That's using exists 2019-07-23 19:03:04 alh not defined 2019-07-23 19:03:07 alh So it can exist and e undef 2019-07-23 19:03:13 alh Which is your problem 2019-07-23 19:03:46 mje__ I said, the original was defined when +the warning was issued and what I pasted was afterwards when it was c +hanged to exists 2019-07-23 19:04:48 mje__ the change from defined to exists is l +ikely wrong but the warning came from the defined case 2019-07-23 19:06:29 alh Can you show more context? 2019-07-23 19:12:38 mje__ https://pastebin.com/sYC3XR31 2019-07-23 19:12:39 Repaster Repasted text from mje__: http +://perl.bot/p/t8p5x4 2019-07-23 19:16:48 alh before line 18 warn the value of $exis +ting_match->{in_control} 2019-07-23 19:17:01 alh Beore line 14 do the same for $events{ +$event_id}->{event_status_id} 2019-07-23 19:17:05 alh That may be where the real warning is +coming from 2019-07-23 19:22:02 mje__ ok, so the crux of the opinion is the +line number is possibly wrong and so other == tests could be at fault +? 2019-07-23 19:24:47 mst the crux of the opinion is "you're con +fused about *something* 2019-07-23 19:24:51 alh Yes. And you can figure out by adding +debug everywhere 2019-07-23 19:24:57 mst I'd probably apply warn + Data::Dumper 2019-07-23 19:25:12 alh If you think $x->{foo} == 1 is warning +, warn reight before that conditional, warn inside that conditional, +warn after that conditional 2019-07-23 19:25:31 alh Where the unintialized value warning a +ppears in regards to what you've added should help you track it down 2019-07-23 19:28:21 Grinnz source filters are also known to screw + up line numbers 2019-07-23 19:29:32 mst oh. yes. if you have 'use Switch;' in +that code, you can assume all line numbers are wrong 2019-07-23 19:30:00 Grinnz (and in that case, that it also caused + the error) 2019-07-23 19:31:00 mje__ Unfortunately this is code working on +live data and although it is possible to play it back the playback is +n't EXACTLY as it was live. We don't use Switch. I hadn't considered +the warning line number was wrong so I've got something to work on. T +hanks 2019-07-23 19:31:43 Grinnz there are still some core bugs that ma +ke wrong line numbers too 2019-07-23 19:34:35 alh Also if a comment like this is anywher +e in the file: 2019-07-23 19:34:38 alh # line 5 10 2019-07-23 19:35:07 alh Or even: 2019-07-23 19:35:09 alh # line 10 2019-07-23 19:35:12 mst honestly I still thing you're just con +fused about the data
    Timestamps are in Europe/Vienna timezone. The log is complete and unmodified. I'd appreciate replies of confirmation that it is so.
Off by one key... or yet another example of why strict and warnings are always a good idea (even for "one-liners")
3 direct replies — Read more / Contribute
by atcroft
on Jul 17, 2019 at 20:02
    "Just sit right back and you'll hear a tale
    a tale of a fateful trip,
    that started from this simple term,
    aboard this single slip."

    Please, dear reader, learn from my mistake. (It will likely be less painful than repeating it yourself.)

    Earlier today I did something I have done dozens of times before-created a command-line perl script (a "one-liner", for some very long definition of a "line") to create a file containing a subset of messages from a set of compressed logs, with the intent of pulling them back to my machine for additional processing. I launched it in a screen session, saw it was running and would take some time to begin generating output, and stepped away for lunch. I was rather surprised, however, when I returned to find it throwing "No space left on device" messages-especially when I looked to find that the partition's previous 40GB of free space was now zero. After cleaning up the space, I began trying to find the cause.

    In digging through my code, I almost missed the issue-a line of the form if ( $str -~ m/some pattern/ ) { print $str; }. Notice the issue? An off-by-one-key error from a en.US keyboard, where [-/_] and [=/+] are beside one another. This was compounded by skipping the well-espoused logic of use strict; use warnings; because it was a "one-liner" (where "-Mstrict -Mwarnings" would have added a mere 19 characters in length). Had I have done so, instead of:

    # made-up example with actual issue $ perl -le 'my $str = q{zxcv}; if ( $str -~ m/some pattern/i ) { print + $str; }' zxcv
    I would have seen:
    # made-up example with actual issue, with strict and warnings $ perl -Mstrict -Mwarnings -le 'my $str = q{zxcv}; if ( $str -~ m/some + pattern/i ) { print $str; }' Use of uninitialized value $_ in pattern match (m//) at -e line 1. Argument "zxcv" isn't numeric in subtraction (-) at -e line 1. zxcv
    Seeing unexpected output like that (that early) would likely have resulted in my cancelling the command to investigate, and thus likely not filling up 40GB of storage.

    I know this will probably be like the tone after the television broadcast day ended to a sleeping viewer, but maybe, just maybe, it will help someone. In the end, learning from others' mistakes is often less painful (but not necessarily as memorable).

    (And yes, I do use the the duo on most every script I write-just not always on "one-liners".)


Add your Meditation
Title:
Meditation:
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 examining the Monastery: (6)
    As of 2019-09-17 04:08 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      The room is dark, and your next move is ...












      Results (199 votes). Check out past polls.

      Notices?