Hmmm... use strict; use warnings; my $a="i.like.donuts.but.only.with.tea"; $a=~s/\.\w+$//; # <---- maybe w+ not d+??? print $a, "\n";
Deutsche Telekom AG T-Com, Technische Infrastruktur Niederlassung Überregional Bastian Angerstein Network Support Center - Network Management Support Maybachstr.57; D-70469 Stuttgart +49 711 8939 1889 (Tel.) +49 711 8939 6604 (Fax) mailto:[EMAIL PROTECTED] http://www.t-com.de -----Ursprüngliche Nachricht----- Von: John Doe [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 8. März 2005 11:46 An: beginners@perl.org Betreff: Re: How to remove everything after the last "." dot? Hi > I have a line: > i.like.donuts.but.only.with.tea > > now I want to remove everything that follows the last "." > including the last ".". > [...] you can use a regex for that. === Documentation (from command line:) perldoc perlre === Code: use strict; use warnings; my $a="i.like.donuts.but.only.with.tea"; $a=~s/\.\d+$//; # <---- this does the trick print $a, "\n"; # this prints: i.like.donuts.but.only.with.tea === explanation: see documentation ;-) greetings joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>