> 
> Or use split and return the last field:
> 
> $ perl -le'
> my $string = "boy, pig, 123, 123:412adbd, d0g,
> lajdlf134><<_ lkadsf !234,\n";
> my $value = ( split /,\s+/, $string )[ -1 ];

Another mind bogling example... :-)
I thought I would do:

my @value = ( split /,\s+/, $string );
print $value[6];

How could your example, have printed the last field using [ -1 ]?
Can I also print say, the 3rd field using this trick?






> print $value;
> '
> lajdlf134><<_ lkadsf !234
> 
> 
> 
> 
> 
> John
> -- Those people who think they know everything are a great
> annoyance to those of us who do.        -- Isaac Asimov
> 
> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/


      

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to