News for hackers. Stuff that matters.
Re:Why Perl? by lanx on Sunday April 23, 2023 @01:59PM (#35678722)
Data::Dumper is included in core Perl ...

    use v5.12.0;
    use warnings;
    use autodie;
    use Data::Dumper;
    
    sub logit {
        open state $log, ">>", 'c:/tmp/foo'; # open *once* for *append*
        print $log Dumper(@_)
    }
    
    
    logit(123);
    
    logit(["spam", "eggs"]);
    

    logit({"(1,2)"=> [3,4,5],"('spam','eggs')"=> [6,7,8]});


    # logging multiple objects at once ...
    logit(
          123,
          ["spam", "eggs"],
          {"(1,2)"=> [3,4,5],"('spam','eggs')"=> [6,7,8]},
         );

NB: Perl has neither tuples nor sets, but there are workarounds

There are no comments on this comment yet.