nite_man has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
Maybe somebody knows how do write a following code without a temporary variable @tmp:
This code doesn't workmy @tmp = split(/\//, '/home/bin/scripts/test.pl'); my $fname = pop @tmp;
because split in the scalar context returns a size of array. Of course, I can use regular expressions, I know it.my $fname = pop split(/\//, '/home/bin/scripts/test.pl');
*-*-*-*-*-* { firstname => 'Michael', quote => 'Mice were crying and stinging but went on nibbling the + cactus', }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using split
by robartes (Priest) on Mar 07, 2003 at 09:03 UTC | |
Re: Using split
by Enlil (Parson) on Mar 07, 2003 at 09:04 UTC | |
Re: Using split
by BrowserUk (Patriarch) on Mar 07, 2003 at 09:29 UTC | |
Re: Using split
by tachyon (Chancellor) on Mar 07, 2003 at 12:10 UTC | |
Re: Using split
by diotalevi (Canon) on Mar 07, 2003 at 11:16 UTC | |
Re: Using split
by Tomte (Priest) on Mar 07, 2003 at 09:24 UTC | |
by IlyaM (Parson) on Mar 07, 2003 at 10:15 UTC | |
Re: Using split
by nite_man (Deacon) on Mar 07, 2003 at 12:32 UTC |
Back to
Seekers of Perl Wisdom