in reply to Re^2: perl pattern match for end of string using STDIN and chomp
in thread perl pattern match for end of string using STDIN and chomp

Ditto on ikegami above, tested v5.8.8 built for x86_64-linux-gnu-thread-multi on Ubuntu 8.04 LTS as well as Windows. What happens when you run this?

#!/usr/bin/perl print "get some string: "; $dropped = chop($string = <STDIN>); print ord $dropped, " ", ord $/, "\n"; #$string = $ARGV[0]; #chomp($string); $string =~ m/\/([[:alnum:]]+)_.*\.(.+)$/; print "$1\n"; $type = $2; print "$type\n"; $string =~ m/(.+)\.${type}$/; #$string =~ m/(.+)\.${type}\Z/; #$string =~ m/(.+)\.${type}\z/; #$string =~ m/(.+)\.${type}/; print "$1\n"; exit 0;

Replies are listed 'Best First'.
Re^4: perl pattern match for end of string using STDIN and chomp
by cbolcato (Novice) on Oct 08, 2009 at 19:31 UTC
    When i run your code i get this:
    get some string: /xxxx/xxxxx/YYY_xxxxx.CCC 10 10 YYY CCC YYY