MonkDrew has asked for the wisdom of the Perl Monks concerning the following question:
Called likesub hg_split{ my @slice = split($_[1],$_[2]); return $slice[$_[0]]; }
Which returns "www". Is there a way to do this without involving a custom subroutine?print hg_split(0,'\.','www.google.com');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split returning one element
by moritz (Cardinal) on Nov 05, 2009 at 18:13 UTC | |
by Anonymous Monk on Nov 05, 2009 at 18:28 UTC | |
by Anonymous Monk on Nov 05, 2009 at 18:35 UTC | |
by moritz (Cardinal) on Nov 05, 2009 at 18:50 UTC | |
by ikegami (Patriarch) on Nov 05, 2009 at 20:39 UTC | |
|
Re: Split returning one element
by toolic (Bishop) on Nov 05, 2009 at 18:13 UTC | |
|
Re: Split returning one element
by AnomalousMonk (Archbishop) on Nov 05, 2009 at 19:52 UTC | |
|
Re: Split returning one element
by keszler (Priest) on Nov 05, 2009 at 18:12 UTC |