Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Basic Coding Tips: Parsimonious Parameterization

by Tanktalus (Canon)
on Jan 29, 2005 at 05:09 UTC ( #426189=note: print w/replies, xml ) Need Help??


in reply to Re^2: Basic Coding Tips: Parsimonious Parameterization
in thread Basic Coding Tips: Parsimonious Parameterization

I have to admit - he couldn't do it much faster than that and still have a subroutine...

(Anyone else notice that @array2 will always be empty since @array1 will get all of @_? Thus, the foreach will always be skipped!)

  • Comment on Re^3: Basic Coding Tips: Parsimonious Parameterization

Replies are listed 'Best First'.
Re^4: Basic Coding Tips: Parsimonious Parameterization
by wazoox (Prior) on Jan 31, 2005 at 12:37 UTC
    Yes :) But it'd works this way:
    sub array_merge(\@\@){ my($array1, $array2) = @_; foreach my $element (@$array2){ @$array1 = (@$array1, $element); }#foreach return @$array1; }#array_merge my @t=array_merge(@liste1, @liste2);
      my @t = (@liste1, @liste2);
      works too. No need to reinvent what the core language already provides in a simple way.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://426189]
help
Chatterbox?
[stevieb]: did my pull request challenge today, Locale::gettext. Weird layout for a dist, and I have no idea how to use it, but it's always nice when you can force someone else's work be use strict; and use warnings; compliant :)
[stevieb]: ahem... s/no idea how to use it/didn't read enough as to what it's used for/
[stevieb]: interestingly enough, someone else got my Devel::Examine:: Subs distribution for their PRC, and I applaud the change. This dist is extremely complicated and mostly obfu, but the person doing it understood PPI enough to change...
[stevieb]: ...something I had overlooked in the extreme depths of the core functionality. After merging, then a couple of extra tweaks, I still have 100% test coverage. Yay for people who write tests!

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2017-01-24 01:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (199 votes). Check out past polls.