[Vienna-pm] slices

Peter J. Holzer hjp-vienna-pm-list at hjp.at
Thu Nov 17 06:14:42 PST 2005


On 2005-11-17 12:01:33 +0100, Johannes Fuernkranz wrote:
> Ich haette mal eine schnelle Frage mit einer (hoffentlich) schnellen 
> Antwort.
> 
> Ich moechte indirekt slices spezifizieren. Geht das? Wie?
> Also etwas wie
> 
> my @a = qw(a b c d e f);
> my $slice = "1..2,4";
my @slice = (1..2,4);

> 
> my @s = @a[$slice];
my @s = @a[@slice];

> # @s sollte nun (b,c,e) sein.
print "@s\n";

=> b c e

	hp

-- 
   _  | Peter J. Holzer    | Ich sehe nun ein, dass Computer wenig
|_|_) | Sysadmin WSR       | geeignet sind, um sich was zu merken.
| |   | hjp at hjp.at         |
__/   | http://www.hjp.at/ |	-- Holger Lembke in dan-am
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/vienna-pm/attachments/20051117/edbf262a/attachment.bin


More information about the Vienna-pm mailing list