Guys,
I must have brain fade, 'cause I can't work out how to do this...
I get a geometry string with "my $geom = $mw -> geometry;" which gives $geom = "104x28+619+498".
I want $geom to be just the "+619+498" part of above.
It seems silly to do it like this, beacuse the if will always be true.
my $geom = $mw -> geometry; if ($geom =~ /.*(\+\d+\+\d+)$/) {$geom = $1};
There must be a simple $geom = ... statement, but I can't see it.
Am I going mad, or is the if the only way to do this?
A pattern match in array context produces a list of matches:
#!/usr/bin/perl
use strict; use warnings;
my $str = '104x28+619+498';
my $geom = join '', $str =~ /.*(\+\d+\+\d+)$/; print "$geom\n";
# This is what I normally use $geom = undef; $geom = $1 if $str =~ /.*(\+\d+\+\d+)$/; print "$geom\n";
print "@{[ $str =~ /.*(\+\d+\+\d+)$/ ]}\n";
# or you can use substitution ($geom = $str) =~ s/^.*(\+\d+\+\d+)$/$1/; print "$geom\n";
Regards, Randy. _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs