Commits

Shlomi Fish committed 1bc4dfb

Add randomise array.

  • Participants
  • Parent commits 401e66b

Comments (0)

Files changed (3)

 
 * Add http://rosettacode.org/wiki/Main_Page .
 
+* #perl FAQ:
+    - randomising an array:
+        - shuffle.
+        - picking a random element: $my_array[rand @my_array]
         - What's the difference between an array reference and an array?
         - Same for hash.
         - "I've tried doing $my_array_ref[3] but it didn't work."
-    - randomising an array:
-        - shuffle.
-        - picking a random element: $my_array[rand @my_array]
 
 * Add a page about training providers:
     - http://pti.co.il/ - Perl Training Israel.

File lib/retrieved-html-parts/Freenode_Sharp_Perl_FAQ.html

 <h3 id="siteSub">From PerlNet</h3><div id="contentSub"></div><div id="jump-to-nav">Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a></div>
 <p>This is the FAQ for <a href="irc://irc.freenode.org/perl" title="irc://irc.freenode.org/perl">Freenode&apos;s #perl channel</a>.
 </p><table class="toc" id="toc" summary="Contents"><tr><td><div id="toctitle">
-<h2>Contents</h2></div><ul><li class="toclevel-1"><a href="#Commonly_Asked_Questions"><span class="tocnumber">1</span> <span class="toctext">Commonly Asked Questions</span></a><ul><li class="toclevel-2"><a href="#What_are_the_Rules_of_Conduct.3F"><span class="tocnumber">1.1</span> <span class="toctext">What are the Rules of Conduct?</span></a><ul><li class="toclevel-3"><a href="#Handling_criticism"><span class="tocnumber">1.1.1</span> <span class="toctext">Handling criticism</span></a></li><li class="toclevel-3"><a href="#English_usage"><span class="tocnumber">1.1.2</span> <span class="toctext">English usage</span></a></li></ul></li><li class="toclevel-2"><a href="#I.27ve_become_an_Operator._What_should_I_do_now.3F"><span class="tocnumber">1.2</span> <span class="toctext">I&apos;ve become an Operator. What should I do now?</span></a></li><li class="toclevel-2"><a href="#What_do_I_need_to_do_to_get_a_good_answer_to_my_question.3F"><span class="tocnumber">1.3</span> <span class="toctext">What do I need to do to get a good answer to my question?</span></a></li><li class="toclevel-2"><a href="#What_is_Considered_On-Topic.3F"><span class="tocnumber">1.4</span> <span class="toctext">What is Considered On-Topic?</span></a><ul><li class="toclevel-3"><a href="#Perl_Includes_CPAN"><span class="tocnumber">1.4.1</span> <span class="toctext">Perl Includes CPAN</span></a></li></ul></li><li class="toclevel-2"><a href="#I_need_help_with_tweaking_a_Perl_script_that_I_found.2C_and_I_don.27t_want_to_learn_Perl._Can_you_guys_help_me.3F"><span class="tocnumber">1.5</span> <span class="toctext">I need help with tweaking a Perl script that I found, and I don&apos;t want to learn Perl. Can you guys help me?</span></a></li><li class="toclevel-2"><a href="#I.27d_like_to_run_a_script_.28which_I_wrote_or_downloaded.29_on_a_cheap_.28or_free.29_web-hosting_that_only_gives_me_FTP._Can_you_help.3F"><span class="tocnumber">1.6</span> <span class="toctext">I&apos;d like to run a script (which I wrote or downloaded) on a cheap (or free) web-hosting that only gives me FTP. Can you help?</span></a></li><li class="toclevel-2"><a href="#I_need_help_with_a_non-Perl_Regular_Expression_.28PHP.2C_grep.2C_PCRE.2C_etc..29"><span class="tocnumber">1.7</span> <span class="toctext">I need help with a non-Perl Regular Expression (PHP, grep, PCRE, etc.)</span></a></li><li class="toclevel-2"><a href="#Can_you_recommend_a_good_Perl_Editor.2FIDE.3F"><span class="tocnumber">1.8</span> <span class="toctext">Can you recommend a good Perl Editor/IDE?</span></a></li><li class="toclevel-2"><a href="#Why_doesn.27t_my_script_run.3F"><span class="tocnumber">1.9</span> <span class="toctext">Why doesn&apos;t my script run?</span></a></li><li class="toclevel-2"><a href="#Why_doesn.27t_my_script_work.3F"><span class="tocnumber">1.10</span> <span class="toctext">Why doesn&apos;t my script work?</span></a></li><li class="toclevel-2"><a href="#How_should_I_write_my_code.3F"><span class="tocnumber">1.11</span> <span class="toctext">How should I write my code?</span></a></li><li class="toclevel-2"><a href="#I_need_to_parse_HTML_with_Perl_.28and_my_Regular_Expression_does_not_work.29"><span class="tocnumber">1.12</span> <span class="toctext">I need to parse HTML with Perl (and my Regular Expression does not work)</span></a></li><li class="toclevel-2"><a href="#Can_I_write_Graphical_User-Interfaces_.28GUIs.29_in_Perl.3F_And_How.3F"><span class="tocnumber">1.13</span> <span class="toctext">Can I write Graphical User-Interfaces (GUIs) in Perl? And How?</span></a></li><li class="toclevel-2"><a href="#How_can_I_break.2Fskip_an_outer_loop.3F"><span class="tocnumber">1.14</span> <span class="toctext">How can I break/skip an outer loop?</span></a></li><li class="toclevel-2"><a href="#How_can_I_include_a_script_into_a_different_script_and_still_see_the_lexical_.28.22my.22.29_variables_declared_there.3F"><span class="tocnumber">1.15</span> <span class="toctext">How can I include a script into a different script and still see the lexical (&quot;my&quot;) variables declared there?</span></a></li><li class="toclevel-2"><a href="#How_can_I_format_numbers_with_certain_digits.3F"><span class="tocnumber">1.16</span> <span class="toctext">How can I format numbers with certain digits?</span></a></li><li class="toclevel-2"><a href="#How_can_I_have_printf_return_a_value_instead_of_outputting_to_a_filehandle.3F"><span class="tocnumber">1.17</span> <span class="toctext">How can I have printf return a value instead of outputting to a filehandle?</span></a></li><li class="toclevel-2"><a href="#Where_else_can_I_go_for_help.3F"><span class="tocnumber">1.18</span> <span class="toctext">Where else can I go for help?</span></a></li><li class="toclevel-2"><a href="#How_do_I_know_the_index_of_the_element_in_a_foreach_loop.3F"><span class="tocnumber">1.19</span> <span class="toctext">How do I know the index of the element in a foreach loop?</span></a></li><li class="toclevel-2"><a href="#Is_there_anyway_to_compile_Perl_code_to_an_executable.3F"><span class="tocnumber">1.20</span> <span class="toctext">Is there anyway to compile Perl code to an executable?</span></a></li><li class="toclevel-2"><a href="#How_do_I_perform_operations_on_entire_directories_.28delete_them.2C_copy_them.2C_etc..29.3F"><span class="tocnumber">1.21</span> <span class="toctext">How do I perform operations on entire directories (delete them, copy them, etc.)?</span></a></li><li class="toclevel-2"><a href="#I_want_to_run_a_shell_command_from_Perl.2C_and_possibly_trap_its_output._How.3F"><span class="tocnumber">1.22</span> <span class="toctext">I want to run a shell command from Perl, and possibly trap its output. How?</span></a></li><li class="toclevel-2"><a href="#How_can_I_Merge_Two_Hashes.3F"><span class="tocnumber">1.23</span> <span class="toctext">How can I Merge Two Hashes?</span></a></li><li class="toclevel-2"><a href="#How_can_I_match_anything-except-a-regex_inside_a_Perl_regular_expression.3F"><span class="tocnumber">1.24</span> <span class="toctext">How can I match anything-except-a-regex inside a Perl regular expression?</span></a></li><li class="toclevel-2"><a href="#Should_I_learn_Perl.3F_Should_I_learn_it_as_well_as_Python.2FRuby.2FPHP.2Fwhatever.3F"><span class="tocnumber">1.25</span> <span class="toctext">Should I learn Perl? Should I learn it as well as Python/Ruby/PHP/whatever?</span></a></li><li class="toclevel-2"><a href="#Is_Perl_better_than_PHP.2C_Python.2C_Ruby.2C_etc..3F"><span class="tocnumber">1.26</span> <span class="toctext">Is Perl better than PHP, Python, Ruby, etc.?</span></a></li><li class="toclevel-2"><a href="#Which_method_to_do_.24TASK_X_is_faster.3F_How_can_I_optimise_my_Perl_programs.3F"><span class="tocnumber">1.27</span> <span class="toctext">Which method to do $TASK_X is faster? How can I optimise my Perl programs?</span></a></li><li class="toclevel-2"><a href="#Oh_no.21_CPAN_won.27t_use_the_packages_it_has_downloaded.21__It_says_the_checksums_are_invalid.21"><span class="tocnumber">1.28</span> <span class="toctext">Oh no! CPAN won&apos;t use the packages it has downloaded! It says the checksums are invalid!</span></a></li><li class="toclevel-2"><a href="#How_can_I_search_for_a_value_inside_an_array.3F"><span class="tocnumber">1.29</span> <span class="toctext">How can I search for a value inside an array?</span></a></li><li class="toclevel-2"><a href="#How_can_I_prepare_a_self-contained_Perl_executable.3F"><span class="tocnumber">1.30</span> <span class="toctext">How can I prepare a self-contained Perl executable?</span></a></li><li class="toclevel-2"><a href="#How_can_I_compile_my_code_to_obscure_.2F_obfuscate_the_source.3F"><span class="tocnumber">1.31</span> <span class="toctext">How can I compile my code to obscure / obfuscate the source?</span></a></li><li class="toclevel-2"><a href="#When_is_Perl_6_going_to_be_ready.3F"><span class="tocnumber">1.32</span> <span class="toctext">When is Perl 6 going to be ready?</span></a></li><li class="toclevel-2"><a href="#Perl_6_is_going_to_be_so_different_from_Perl_5._Should_I_still_learn_Perl_5.3F"><span class="tocnumber">1.33</span> <span class="toctext">Perl 6 is going to be so different from Perl 5. Should I still learn Perl 5?</span></a></li><li class="toclevel-2"><a href="#How_can_I_match_a_string_variable_inside_a_regex.3F"><span class="tocnumber">1.34</span> <span class="toctext">How can I match a string variable inside a regex?</span></a></li><li class="toclevel-2"><a href="#Where_can_I_find_lists_of_Programming_Challenges.3F"><span class="tocnumber">1.35</span> <span class="toctext">Where can I find lists of Programming Challenges?</span></a></li><li class="toclevel-2"><a href="#Where_can_I_find_an_interactive_version_of_Perl.3F_.28a.k.a_a_REPL_-_Read-Eval-Print-Loop.29"><span class="tocnumber">1.36</span> <span class="toctext">Where can I find an interactive version of Perl? (a.k.a a REPL - Read-Eval-Print-Loop)</span></a></li><li class="toclevel-2"><a href="#How_can_I_store_Perl_Data_Structures_on_the_Hard_Disk.3F"><span class="tocnumber">1.37</span> <span class="toctext">How can I store Perl Data Structures on the Hard Disk?</span></a></li><li class="toclevel-2"><a href="#How_can_I_do_a_switch_statement_in_Perl.3F"><span class="tocnumber">1.38</span> <span class="toctext">How can I do a switch statement in Perl?</span></a></li><li class="toclevel-2"><a href="#How_can_I_determine_the_type_of_a_reference_.28array.2C_hash.2C_scalar.2C_etc..29.3F"><span class="tocnumber">1.39</span> <span class="toctext">How can I determine the type of a reference (array, hash, scalar, etc.)?</span></a></li><li class="toclevel-2"><a href="#How_can_I_parse_a_CSV_.28Comma_separated_value_.2F_comma_delimited_value.29_file.3F"><span class="tocnumber">1.40</span> <span class="toctext">How can I parse a CSV (Comma separated value / comma delimited value) file?</span></a></li><li class="toclevel-2"><a href="#How_can_I_access_the_global_variables_in_my_script_from_a_different_module_and.2For_namespace"><span class="tocnumber">1.41</span> <span class="toctext">How can I access the global variables in my script from a different module and/or namespace</span></a></li><li class="toclevel-2"><a href="#How_can_I_set_up_a_timeout_for_a_blocking_operation.3F"><span class="tocnumber">1.42</span> <span class="toctext">How can I set up a timeout for a blocking operation?</span></a></li><li class="toclevel-2"><a href="#How_can_I_match_.28and_possibly_replace.29_the_Nth_expression_out_of_a_string.3F"><span class="tocnumber">1.43</span> <span class="toctext">How can I match (and possibly replace) the Nth expression out of a string?</span></a></li><li class="toclevel-2"><a href="#How_do_I_prepend_data_to_a_file.2C_take_out.2Fdelete_data_from_the_middle_of_the_file_or_insert_data_into_the_middle_of_the_file.3F"><span class="tocnumber">1.44</span> <span class="toctext">How do I prepend data to a file, take out/delete data from the middle of the file or insert data into the middle of the file?</span></a></li><li class="toclevel-2"><a href="#How_do_I_pass_a_reference_to_an_object.27s_method.3F_.28Also_known_as_class_subroutine_or_member_function.29"><span class="tocnumber">1.45</span> <span class="toctext">How do I pass a reference to an object&apos;s method? (Also known as class subroutine or member function)</span></a></li><li class="toclevel-2"><a href="#How_do_I_trim_leading_and.2For_trailing_whitespace_from_a_string.3F"><span class="tocnumber">1.46</span> <span class="toctext">How do I trim leading and/or trailing whitespace from a string?</span></a></li><li class="toclevel-2"><a href="#How_do_I_add_directories_to_the_list_of_paths_where_Perl_searches_for_modules.3F_.28.40INC.29"><span class="tocnumber">1.47</span> <span class="toctext">How do I add directories to the list of paths where Perl searches for modules? (@INC)</span></a></li><li class="toclevel-2"><a href="#How_can_I_get_perl_to_print_each_line_as_it_is_executed_.28similar_to_the_shell.27s_-x_flag.29.3F"><span class="tocnumber">1.48</span> <span class="toctext">How can I get perl to print each line as it is executed (similar to the shell&apos;s -x flag)?</span></a></li><li class="toclevel-2"><a href="#I.27m_trying_to_use_threads_to_speed_up_my_program._What_should_I_know.3F"><span class="tocnumber">1.49</span> <span class="toctext">I&apos;m trying to use threads to speed up my program. What should I know?</span></a></li><li class="toclevel-2"><a href="#Should_I_be_using_mod_perl.3F"><span class="tocnumber">1.50</span> <span class="toctext">Should I be using mod_perl?</span></a></li><li class="toclevel-2"><a href="#How_can_I_find_which_modules_a_Perl_program_or_module_depends_on.3F"><span class="tocnumber">1.51</span> <span class="toctext">How can I find which modules a Perl program or module depends on?</span></a></li></ul></li><li class="toclevel-1"><a href="#Some_Related_IRC_Channels_on_Freenode"><span class="tocnumber">2</span> <span class="toctext">Some Related IRC Channels on Freenode</span></a><ul><li class="toclevel-2"><a href="#.23perlcafe"><span class="tocnumber">2.1</span> <span class="toctext">#perlcafe</span></a></li><li class="toclevel-2"><a href="#.23perl6"><span class="tocnumber">2.2</span> <span class="toctext">#perl6</span></a></li><li class="toclevel-2"><a href="#.23lispcafe"><span class="tocnumber">2.3</span> <span class="toctext">#lispcafe</span></a></li><li class="toclevel-2"><a href="#.23perl-cats"><span class="tocnumber">2.4</span> <span class="toctext">#perl-cats</span></a></li></ul></li><li class="toclevel-1"><a href="#People"><span class="tocnumber">3</span> <span class="toctext">People</span></a><ul><li class="toclevel-2"><a href="#Channel_Owner"><span class="tocnumber">3.1</span> <span class="toctext">Channel Owner</span></a><ul><li class="toclevel-3"><a href="#thrig"><span class="tocnumber">3.1.1</span> <span class="toctext">thrig</span></a></li></ul></li><li class="toclevel-2"><a href="#Channel_Operators"><span class="tocnumber">3.2</span> <span class="toctext">Channel Operators</span></a><ul><li class="toclevel-3"><a href="#apeiron"><span class="tocnumber">3.2.1</span> <span class="toctext">apeiron</span></a></li><li class="toclevel-3"><a href="#beth"><span class="tocnumber">3.2.2</span> <span class="toctext">beth</span></a></li><li class="toclevel-3"><a href="#Chris62vw"><span class="tocnumber">3.2.3</span> <span class="toctext">Chris62vw</span></a></li><li class="toclevel-3"><a href="#f00li5h"><span class="tocnumber">3.2.4</span> <span class="toctext">f00li5h</span></a></li><li class="toclevel-3"><a href="#mst"><span class="tocnumber">3.2.5</span> <span class="toctext">mst</span></a></li><li class="toclevel-3"><a href="#Paladin"><span class="tocnumber">3.2.6</span> <span class="toctext">Paladin</span></a></li><li class="toclevel-3"><a href="#rindolf"><span class="tocnumber">3.2.7</span> <span class="toctext">rindolf</span></a></li><li class="toclevel-3"><a href="#simcop2387"><span class="tocnumber">3.2.8</span> <span class="toctext">simcop2387</span></a></li></ul></li><li class="toclevel-2"><a href="#Channel_Regulars"><span class="tocnumber">3.3</span> <span class="toctext">Channel Regulars</span></a><ul><li class="toclevel-3"><a href="#ivantis.5B.5E3.5D.2A"><span class="tocnumber">3.3.1</span> <span class="toctext">ivantis[^3]*</span></a></li><li class="toclevel-3"><a href="#alanhaggai"><span class="tocnumber">3.3.2</span> <span class="toctext">alanhaggai</span></a></li><li class="toclevel-3"><a href="#dazjorz"><span class="tocnumber">3.3.3</span> <span class="toctext">dazjorz</span></a></li><li class="toclevel-3"><a href="#pkrumins"><span class="tocnumber">3.3.4</span> <span class="toctext">pkrumins</span></a></li><li class="toclevel-3"><a href="#whoppix"><span class="tocnumber">3.3.5</span> <span class="toctext">whoppix</span></a></li></ul></li><li class="toclevel-2"><a href="#Bots"><span class="tocnumber">3.4</span> <span class="toctext">Bots</span></a><ul><li class="toclevel-3"><a href="#perlbot"><span class="tocnumber">3.4.1</span> <span class="toctext">perlbot</span></a></li><li class="toclevel-3"><a href="#buubot"><span class="tocnumber">3.4.2</span> <span class="toctext">buubot</span></a></li><li class="toclevel-3"><a href="#CPAN2"><span class="tocnumber">3.4.3</span> <span class="toctext">CPAN2</span></a></li><li class="toclevel-3"><a href="#GumbyPAN"><span class="tocnumber">3.4.4</span> <span class="toctext">GumbyPAN</span></a></li><li class="toclevel-3"><a href="#GumbyBRAIN"><span class="tocnumber">3.4.5</span> <span class="toctext">GumbyBRAIN</span></a></li><li class="toclevel-3"><a href="#farnsworth"><span class="tocnumber">3.4.6</span> <span class="toctext">farnsworth</span></a></li><li class="toclevel-3"><a href="#perlbot2"><span class="tocnumber">3.4.7</span> <span class="toctext">perlbot2</span></a></li><li class="toclevel-3"><a href="#f00bot"><span class="tocnumber">3.4.8</span> <span class="toctext">f00bot</span></a></li><li class="toclevel-3"><a href="#ivantis3.5B.60_.5D.2A"><span class="tocnumber">3.4.9</span> <span class="toctext">ivantis3[`_]*</span></a></li></ul></li></ul></li><li class="toclevel-1"><a href="#Our_Milestone_Pictures"><span class="tocnumber">4</span> <span class="toctext">Our Milestone Pictures</span></a></li></ul></td></tr></table>
+<h2>Contents</h2></div>
+
+<ul>
+<li class="toclevel-1"><a href="#Commonly_Asked_Questions"><span class="tocnumber">1</span> <span class="toctext">Commonly Asked Questions</span></a><ul>
+<li class="toclevel-2"><a href="#What_are_the_Rules_of_Conduct.3F"><span class="tocnumber">1.1</span> <span class="toctext">What are the Rules of Conduct?</span></a><ul>
+<li class="toclevel-3"><a href="#Handling_criticism"><span class="tocnumber">1.1.1</span> <span class="toctext">Handling criticism</span></a></li>
+<li class="toclevel-3"><a href="#English_usage"><span class="tocnumber">1.1.2</span> <span class="toctext">English usage</span></a></li></ul></li>
+<li class="toclevel-2"><a href="#I.27ve_become_an_Operator._What_should_I_do_now.3F"><span class="tocnumber">1.2</span> <span class="toctext">I&apos;ve become an Operator. What should I do now?</span></a></li>
+<li class="toclevel-2"><a href="#What_do_I_need_to_do_to_get_a_good_answer_to_my_question.3F"><span class="tocnumber">1.3</span> <span class="toctext">What do I need to do to get a good answer to my question?</span></a></li>
+<li class="toclevel-2"><a href="#What_is_Considered_On-Topic.3F"><span class="tocnumber">1.4</span> <span class="toctext">What is Considered On-Topic?</span></a><ul>
+<li class="toclevel-3"><a href="#Perl_Includes_CPAN"><span class="tocnumber">1.4.1</span> <span class="toctext">Perl Includes CPAN</span></a></li></ul></li>
+<li class="toclevel-2"><a href="#I_need_help_with_tweaking_a_Perl_script_that_I_found.2C_and_I_don.27t_want_to_learn_Perl._Can_you_guys_help_me.3F"><span class="tocnumber">1.5</span> <span class="toctext">I need help with tweaking a Perl script that I found, and I don&apos;t want to learn Perl. Can you guys help me?</span></a></li>
+<li class="toclevel-2"><a href="#I.27d_like_to_run_a_script_.28which_I_wrote_or_downloaded.29_on_a_cheap_.28or_free.29_web-hosting_that_only_gives_me_FTP._Can_you_help.3F"><span class="tocnumber">1.6</span> <span class="toctext">I&apos;d like to run a script (which I wrote or downloaded) on a cheap (or free) web-hosting that only gives me FTP. Can you help?</span></a></li>
+<li class="toclevel-2"><a href="#I_need_help_with_a_non-Perl_Regular_Expression_.28PHP.2C_grep.2C_PCRE.2C_etc..29"><span class="tocnumber">1.7</span> <span class="toctext">I need help with a non-Perl Regular Expression (PHP, grep, PCRE, etc.)</span></a></li>
+<li class="toclevel-2"><a href="#Can_you_recommend_a_good_Perl_Editor.2FIDE.3F"><span class="tocnumber">1.8</span> <span class="toctext">Can you recommend a good Perl Editor/IDE?</span></a></li>
+<li class="toclevel-2"><a href="#Why_doesn.27t_my_script_run.3F"><span class="tocnumber">1.9</span> <span class="toctext">Why doesn&apos;t my script run?</span></a></li>
+<li class="toclevel-2"><a href="#Why_doesn.27t_my_script_work.3F"><span class="tocnumber">1.10</span> <span class="toctext">Why doesn&apos;t my script work?</span></a></li>
+<li class="toclevel-2"><a href="#How_should_I_write_my_code.3F"><span class="tocnumber">1.11</span> <span class="toctext">How should I write my code?</span></a></li>
+<li class="toclevel-2"><a href="#I_need_to_parse_HTML_with_Perl_.28and_my_Regular_Expression_does_not_work.29"><span class="tocnumber">1.12</span> <span class="toctext">I need to parse HTML with Perl (and my Regular Expression does not work)</span></a></li>
+<li class="toclevel-2"><a href="#Can_I_write_Graphical_User-Interfaces_.28GUIs.29_in_Perl.3F_And_How.3F"><span class="tocnumber">1.13</span> <span class="toctext">Can I write Graphical User-Interfaces (GUIs) in Perl? And How?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_break.2Fskip_an_outer_loop.3F"><span class="tocnumber">1.14</span> <span class="toctext">How can I break/skip an outer loop?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_include_a_script_into_a_different_script_and_still_see_the_lexical_.28.22my.22.29_variables_declared_there.3F"><span class="tocnumber">1.15</span> <span class="toctext">How can I include a script into a different script and still see the lexical (&quot;my&quot;) variables declared there?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_format_numbers_with_certain_digits.3F"><span class="tocnumber">1.16</span> <span class="toctext">How can I format numbers with certain digits?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_have_printf_return_a_value_instead_of_outputting_to_a_filehandle.3F"><span class="tocnumber">1.17</span> <span class="toctext">How can I have printf return a value instead of outputting to a filehandle?</span></a></li>
+<li class="toclevel-2"><a href="#Where_else_can_I_go_for_help.3F"><span class="tocnumber">1.18</span> <span class="toctext">Where else can I go for help?</span></a></li>
+<li class="toclevel-2"><a href="#How_do_I_know_the_index_of_the_element_in_a_foreach_loop.3F"><span class="tocnumber">1.19</span> <span class="toctext">How do I know the index of the element in a foreach loop?</span></a></li>
+<li class="toclevel-2"><a href="#Is_there_anyway_to_compile_Perl_code_to_an_executable.3F"><span class="tocnumber">1.20</span> <span class="toctext">Is there anyway to compile Perl code to an executable?</span></a></li>
+<li class="toclevel-2"><a href="#How_do_I_perform_operations_on_entire_directories_.28delete_them.2C_copy_them.2C_etc..29.3F"><span class="tocnumber">1.21</span> <span class="toctext">How do I perform operations on entire directories (delete them, copy them, etc.)?</span></a></li>
+<li class="toclevel-2"><a href="#I_want_to_run_a_shell_command_from_Perl.2C_and_possibly_trap_its_output._How.3F"><span class="tocnumber">1.22</span> <span class="toctext">I want to run a shell command from Perl, and possibly trap its output. How?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_Merge_Two_Hashes.3F"><span class="tocnumber">1.23</span> <span class="toctext">How can I Merge Two Hashes?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_match_anything-except-a-regex_inside_a_Perl_regular_expression.3F"><span class="tocnumber">1.24</span> <span class="toctext">How can I match anything-except-a-regex inside a Perl regular expression?</span></a></li>
+<li class="toclevel-2"><a href="#Should_I_learn_Perl.3F_Should_I_learn_it_as_well_as_Python.2FRuby.2FPHP.2Fwhatever.3F"><span class="tocnumber">1.25</span> <span class="toctext">Should I learn Perl? Should I learn it as well as Python/Ruby/PHP/whatever?</span></a></li>
+<li class="toclevel-2"><a href="#Is_Perl_better_than_PHP.2C_Python.2C_Ruby.2C_etc..3F"><span class="tocnumber">1.26</span> <span class="toctext">Is Perl better than PHP, Python, Ruby, etc.?</span></a></li>
+<li class="toclevel-2"><a href="#Which_method_to_do_.24TASK_X_is_faster.3F_How_can_I_optimise_my_Perl_programs.3F"><span class="tocnumber">1.27</span> <span class="toctext">Which method to do $TASK_X is faster? How can I optimise my Perl programs?</span></a></li>
+<li class="toclevel-2"><a href="#Oh_no.21_CPAN_won.27t_use_the_packages_it_has_downloaded.21__It_says_the_checksums_are_invalid.21"><span class="tocnumber">1.28</span> <span class="toctext">Oh no! CPAN won&apos;t use the packages it has downloaded! It says the checksums are invalid!</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_search_for_a_value_inside_an_array.3F"><span class="tocnumber">1.29</span> <span class="toctext">How can I search for a value inside an array?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_prepare_a_self-contained_Perl_executable.3F"><span class="tocnumber">1.30</span> <span class="toctext">How can I prepare a self-contained Perl executable?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_compile_my_code_to_obscure_.2F_obfuscate_the_source.3F"><span class="tocnumber">1.31</span> <span class="toctext">How can I compile my code to obscure / obfuscate the source?</span></a></li>
+<li class="toclevel-2"><a href="#When_is_Perl_6_going_to_be_ready.3F"><span class="tocnumber">1.32</span> <span class="toctext">When is Perl 6 going to be ready?</span></a></li>
+<li class="toclevel-2"><a href="#Perl_6_is_going_to_be_so_different_from_Perl_5._Should_I_still_learn_Perl_5.3F"><span class="tocnumber">1.33</span> <span class="toctext">Perl 6 is going to be so different from Perl 5. Should I still learn Perl 5?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_match_a_string_variable_inside_a_regex.3F"><span class="tocnumber">1.34</span> <span class="toctext">How can I match a string variable inside a regex?</span></a></li>
+<li class="toclevel-2"><a href="#Where_can_I_find_lists_of_Programming_Challenges.3F"><span class="tocnumber">1.35</span> <span class="toctext">Where can I find lists of Programming Challenges?</span></a></li>
+<li class="toclevel-2"><a href="#Where_can_I_find_an_interactive_version_of_Perl.3F_.28a.k.a_a_REPL_-_Read-Eval-Print-Loop.29"><span class="tocnumber">1.36</span> <span class="toctext">Where can I find an interactive version of Perl? (a.k.a a REPL - Read-Eval-Print-Loop)</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_store_Perl_Data_Structures_on_the_Hard_Disk.3F"><span class="tocnumber">1.37</span> <span class="toctext">How can I store Perl Data Structures on the Hard Disk?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_do_a_switch_statement_in_Perl.3F"><span class="tocnumber">1.38</span> <span class="toctext">How can I do a switch statement in Perl?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_determine_the_type_of_a_reference_.28array.2C_hash.2C_scalar.2C_etc..29.3F"><span class="tocnumber">1.39</span> <span class="toctext">How can I determine the type of a reference (array, hash, scalar, etc.)?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_parse_a_CSV_.28Comma_separated_value_.2F_comma_delimited_value.29_file.3F"><span class="tocnumber">1.40</span> <span class="toctext">How can I parse a CSV (Comma separated value / comma delimited value) file?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_access_the_global_variables_in_my_script_from_a_different_module_and.2For_namespace"><span class="tocnumber">1.41</span> <span class="toctext">How can I access the global variables in my script from a different module and/or namespace</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_set_up_a_timeout_for_a_blocking_operation.3F"><span class="tocnumber">1.42</span> <span class="toctext">How can I set up a timeout for a blocking operation?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_match_.28and_possibly_replace.29_the_Nth_expression_out_of_a_string.3F"><span class="tocnumber">1.43</span> <span class="toctext">How can I match (and possibly replace) the Nth expression out of a string?</span></a></li>
+<li class="toclevel-2"><a href="#How_do_I_prepend_data_to_a_file.2C_take_out.2Fdelete_data_from_the_middle_of_the_file_or_insert_data_into_the_middle_of_the_file.3F"><span class="tocnumber">1.44</span> <span class="toctext">How do I prepend data to a file, take out/delete data from the middle of the file or insert data into the middle of the file?</span></a></li>
+<li class="toclevel-2"><a href="#How_do_I_pass_a_reference_to_an_object.27s_method.3F_.28Also_known_as_class_subroutine_or_member_function.29"><span class="tocnumber">1.45</span> <span class="toctext">How do I pass a reference to an object&apos;s method? (Also known as class subroutine or member function)</span></a></li>
+<li class="toclevel-2"><a href="#How_do_I_trim_leading_and.2For_trailing_whitespace_from_a_string.3F"><span class="tocnumber">1.46</span> <span class="toctext">How do I trim leading and/or trailing whitespace from a string?</span></a></li>
+<li class="toclevel-2"><a href="#How_do_I_add_directories_to_the_list_of_paths_where_Perl_searches_for_modules.3F_.28.40INC.29"><span class="tocnumber">1.47</span> <span class="toctext">How do I add directories to the list of paths where Perl searches for modules? (@INC)</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_get_perl_to_print_each_line_as_it_is_executed_.28similar_to_the_shell.27s_-x_flag.29.3F"><span class="tocnumber">1.48</span> <span class="toctext">How can I get perl to print each line as it is executed (similar to the shell&apos;s -x flag)?</span></a></li>
+<li class="toclevel-2"><a href="#I.27m_trying_to_use_threads_to_speed_up_my_program._What_should_I_know.3F"><span class="tocnumber">1.49</span> <span class="toctext">I&apos;m trying to use threads to speed up my program. What should I know?</span></a></li>
+<li class="toclevel-2"><a href="#Should_I_be_using_mod_perl.3F"><span class="tocnumber">1.50</span> <span class="toctext">Should I be using mod_perl?</span></a></li>
+<li class="toclevel-2"><a href="#How_can_I_find_which_modules_a_Perl_program_or_module_depends_on.3F"><span class="tocnumber">1.51</span> <span class="toctext">How can I find which modules a Perl program or module depends on?</span></a></li></ul></li>
+<li class="toclevel-2"><a href="#randomise-array"><span class="tocnumber">1.51</span> <span class="toctext">How can I randomise an array? E.g: pick a random element or shuffle it?</span></a></li></ul></li>
+<li class="toclevel-1"><a href="#Some_Related_IRC_Channels_on_Freenode"><span class="tocnumber">2</span> <span class="toctext">Some Related IRC Channels on Freenode</span></a><ul>
+<li class="toclevel-2"><a href="#.23perlcafe"><span class="tocnumber">2.1</span> <span class="toctext">#perlcafe</span></a></li>
+<li class="toclevel-2"><a href="#.23perl6"><span class="tocnumber">2.2</span> <span class="toctext">#perl6</span></a></li>
+<li class="toclevel-2"><a href="#.23lispcafe"><span class="tocnumber">2.3</span> <span class="toctext">#lispcafe</span></a></li>
+<li class="toclevel-2"><a href="#.23perl-cats"><span class="tocnumber">2.4</span> <span class="toctext">#perl-cats</span></a></li></ul></li>
+<li class="toclevel-1"><a href="#People"><span class="tocnumber">3</span> <span class="toctext">People</span></a><ul>
+<li class="toclevel-2"><a href="#Channel_Owner"><span class="tocnumber">3.1</span> <span class="toctext">Channel Owner</span></a><ul>
+<li class="toclevel-3"><a href="#thrig"><span class="tocnumber">3.1.1</span> <span class="toctext">thrig</span></a></li></ul></li>
+<li class="toclevel-2"><a href="#Channel_Operators"><span class="tocnumber">3.2</span> <span class="toctext">Channel Operators</span></a><ul>
+<li class="toclevel-3"><a href="#apeiron"><span class="tocnumber">3.2.1</span> <span class="toctext">apeiron</span></a></li>
+<li class="toclevel-3"><a href="#beth"><span class="tocnumber">3.2.2</span> <span class="toctext">beth</span></a></li>
+<li class="toclevel-3"><a href="#Chris62vw"><span class="tocnumber">3.2.3</span> <span class="toctext">Chris62vw</span></a></li>
+<li class="toclevel-3"><a href="#f00li5h"><span class="tocnumber">3.2.4</span> <span class="toctext">f00li5h</span></a></li>
+<li class="toclevel-3"><a href="#mst"><span class="tocnumber">3.2.5</span> <span class="toctext">mst</span></a></li>
+<li class="toclevel-3"><a href="#Paladin"><span class="tocnumber">3.2.6</span> <span class="toctext">Paladin</span></a></li>
+<li class="toclevel-3"><a href="#rindolf"><span class="tocnumber">3.2.7</span> <span class="toctext">rindolf</span></a></li>
+<li class="toclevel-3"><a href="#simcop2387"><span class="tocnumber">3.2.8</span> <span class="toctext">simcop2387</span></a></li></ul></li>
+<li class="toclevel-2"><a href="#Channel_Regulars"><span class="tocnumber">3.3</span> <span class="toctext">Channel Regulars</span></a><ul>
+<li class="toclevel-3"><a href="#ivantis.5B.5E3.5D.2A"><span class="tocnumber">3.3.1</span> <span class="toctext">ivantis[^3]*</span></a></li>
+<li class="toclevel-3"><a href="#alanhaggai"><span class="tocnumber">3.3.2</span> <span class="toctext">alanhaggai</span></a></li>
+<li class="toclevel-3"><a href="#dazjorz"><span class="tocnumber">3.3.3</span> <span class="toctext">dazjorz</span></a></li>
+<li class="toclevel-3"><a href="#pkrumins"><span class="tocnumber">3.3.4</span> <span class="toctext">pkrumins</span></a></li>
+<li class="toclevel-3"><a href="#whoppix"><span class="tocnumber">3.3.5</span> <span class="toctext">whoppix</span></a></li></ul></li>
+<li class="toclevel-2"><a href="#Bots"><span class="tocnumber">3.4</span> <span class="toctext">Bots</span></a><ul>
+<li class="toclevel-3"><a href="#perlbot"><span class="tocnumber">3.4.1</span> <span class="toctext">perlbot</span></a></li>
+<li class="toclevel-3"><a href="#buubot"><span class="tocnumber">3.4.2</span> <span class="toctext">buubot</span></a></li>
+<li class="toclevel-3"><a href="#CPAN2"><span class="tocnumber">3.4.3</span> <span class="toctext">CPAN2</span></a></li>
+<li class="toclevel-3"><a href="#GumbyPAN"><span class="tocnumber">3.4.4</span> <span class="toctext">GumbyPAN</span></a></li>
+<li class="toclevel-3"><a href="#GumbyBRAIN"><span class="tocnumber">3.4.5</span> <span class="toctext">GumbyBRAIN</span></a></li>
+<li class="toclevel-3"><a href="#farnsworth"><span class="tocnumber">3.4.6</span> <span class="toctext">farnsworth</span></a></li>
+<li class="toclevel-3"><a href="#perlbot2"><span class="tocnumber">3.4.7</span> <span class="toctext">perlbot2</span></a></li>
+<li class="toclevel-3"><a href="#f00bot"><span class="tocnumber">3.4.8</span> <span class="toctext">f00bot</span></a></li>
+<li class="toclevel-3"><a href="#ivantis3.5B.60_.5D.2A"><span class="tocnumber">3.4.9</span> <span class="toctext">ivantis3[`_]*</span></a></li></ul></li></ul></li>
+<li class="toclevel-1"><a href="#Our_Milestone_Pictures"><span class="tocnumber">4</span> <span class="toctext">Our Milestone Pictures</span></a></li></ul></td></tr></table>
 <h2 id="Commonly_Asked_Questions"> Commonly Asked Questions </h2>
-<h3 id="What_are_the_Rules_of_Conduct.3F"> What are the Rules of Conduct? </h3><ol><li> Don&apos;t flood the channel with your paste. Instead use a pastebot - type <tt>perlbot paste</tt>. </li><li> Be civil and friendly. </li><li> Try to use proper English spelling, grammar, syntax, and phrasing. This will help the channel members understand your questions more easily and thus allow them to provide better answers. </li><li> Whenever someone helps you then: <ol><li> Thank them! </li><li> Bump their karma. For example if <tt>johndoe</tt> helps you then say <tt>johndoe++</tt>. </li></ol></li><li> When addressing a channel member, start your message with their nickname followed by a colon (&quot;:&quot;). For example <tt>johndoe: I understand it now.</tt> Your IRC client may have an option to make this easier. Do not use forum/twitter-like notation of <tt>@nick</tt> because most clients will not highlight it specially. </li><li> Do not private message (PM) a channel member using <tt>/msg</tt>, in order to ask a technical question, or to answer a question that they are asking you. This is considered rude, and you are preventing the other channel members from participating in the conversation and helping as well. </li><li> Don&apos;t <b>overuse the evalbot</b> (<tt>eval: 5+6</tt>). The eval bot is primarily meant for experts to show working snippets of code to people who need help. It is not meant as your personal evaluator. If you still want to experiment then <tt>/join #perlbot</tt>. </li><li> If someone needs too much help and handholding, please ask them to chat on one of the symbiont channels such as <tt>#perlcafe</tt> or <tt>#perl-cats</tt>. This will help increase the signal-to-noise ratio of #perl. </li></ol>
+<h3 id="What_are_the_Rules_of_Conduct.3F"> What are the Rules of Conduct? </h3><ol>
+<li> Don&apos;t flood the channel with your paste. Instead use a pastebot - type <tt>perlbot paste</tt>. </li>
+<li> Be civil and friendly. </li>
+<li> Try to use proper English spelling, grammar, syntax, and phrasing. This will help the channel members understand your questions more easily and thus allow them to provide better answers. </li>
+<li> Whenever someone helps you then: <ol>
+<li> Thank them! </li>
+<li> Bump their karma. For example if <tt>johndoe</tt> helps you then say <tt>johndoe++</tt>. </li></ol></li>
+<li> When addressing a channel member, start your message with their nickname followed by a colon (&quot;:&quot;). For example <tt>johndoe: I understand it now.</tt> Your IRC client may have an option to make this easier. Do not use forum/twitter-like notation of <tt>@nick</tt> because most clients will not highlight it specially. </li>
+<li> Do not private message (PM) a channel member using <tt>/msg</tt>, in order to ask a technical question, or to answer a question that they are asking you. This is considered rude, and you are preventing the other channel members from participating in the conversation and helping as well. </li>
+<li> Don&apos;t <b>overuse the evalbot</b> (<tt>eval: 5+6</tt>). The eval bot is primarily meant for experts to show working snippets of code to people who need help. It is not meant as your personal evaluator. If you still want to experiment then <tt>/join #perlbot</tt>. </li>
+<li> If someone needs too much help and handholding, please ask them to chat on one of the symbiont channels such as <tt>#perlcafe</tt> or <tt>#perl-cats</tt>. This will help increase the signal-to-noise ratio of #perl. </li></ol>
 
 <h4 id="Handling_criticism"> Handling criticism </h4>
 <p>As usual the rule is <b>Don&apos;t be right - be smart.</b>. When someone criticises you (and may be an op), you should: 1. Ask them what they mean. 2. Agree and empathise with them, 3. Try to negotiate a common ground. Don&apos;t try to be defensive-aggressive and try to prove the other side&apos;s wrong because that will only make them more angry at you.
 </p>
 <p>One can also use the <a href="http://deps.cpantesters.org/" title="http://deps.cpantesters.org/">CPAN dependencies</a> tool to determine the dependencies of a CPAN distribution or module.
 </p>
+<h3 id="randomise-array"> How can I randomise an array? E.g: pick a random element or shuffle it? </h3>
+
+<p>
+If you want to pick a random element out of an array, you can use:
+<tt>$my_array[rand(@my_array)]</tt> (note that rand forces <tt>@my_array</tt>
+to be in a scalar context which thus becomes its length).
+</p>
+
+<p>
+For shuffling an array (i.e: arranging all its elements in a random order)
+see
+<a href="http://perldoc.perl.org/perlfaq4.html#How-do-I-shuffle-an-array-randomly?">the perlfaq4 question “How do I shuffle an array randomly?”</a>
+</p>
+
 <h2 id="Some_Related_IRC_Channels_on_Freenode"> Some Related IRC Channels on Freenode </h2>
 <h3 id="sharp_perlcafe"><a href="irc://irc.freenode.net/perlcafe" title="irc://irc.freenode.net/perlcafe">#perlcafe</a></h3>
 <p>The <a href="http://perl.net.au/wiki/Freenode_Sharp_Perlcafe" title="Freenode Sharp Perlcafe">Perl Café</a> exists to move off-topic discussions out of #perl. The channel is very lax, but often heavy on the irony. Examples of conversation include: