oryann9 wrote:
Dr. Ruud wrote:
"Mumia W." schreef:
my $lang = ($topdir =~ /([^\/]+)$/)[0];
ITYRMSL:
my ($lang) = $topdir =~ m~([^/]+)$~;
I have never seen the expression m~ or $~
Will you tell me what this is and what is says?
Like all Perl quoted constructs, the pattern match
can t
Dr.Ruud wrote:
"Mumia W." schreef:
my $lang = ($topdir =~ /([^\/]+)$/)[0];
ITYRMSL:
my ($lang) = $topdir =~ m~([^/]+)$~;
IDUWYM. CYETUP?
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
>
> my ($lang) = $topdir =~ m~([^/]+)$~;
>
> --
I have never seen the expression m~ or $~
Will you tell me what this is and what is says?
m~foobar$~ is the same as,
m/foobar$/
here m~ and $~ are not special operators or variables at all,just the
board-symbol for regex.:)
> "Mumia W." schreef:
>
> > my $lang = ($topdir =~ /([^\/]+)$/)[0];
>
> ITYRMSL:
>
> my ($lang) = $topdir =~ m~([^/]+)$~;
>
> --
Dr Rudd,
I have never seen the expression m~ or $~
Will you tell me what this is and what is says?
thank you
"Mumia W." schreef:
> my $lang = ($topdir =~ /([^\/]+)$/)[0];
ITYRMSL:
my ($lang) = $topdir =~ m~([^/]+)$~;
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 04/18/2007 10:26 PM, Nishi wrote:
Hi:
I am using the following reqular expression to extract the last part ie
$lang of the following string
$topdir = "common/default/l_cs";
my $lang=$topdir =~ /.*\/(.+)$/;
But it doesnt seem to work, what am i missing here?
Thanks!
my $lang = ($topdir =~
For your purpose,using Perl's built-in module File::Basename is a good way.
use File::Basename;
my $filename = basename($topdir);
my $dirname = dirname($topdir);
Good luck!
2007/4/19, Nishi <[EMAIL PROTECTED]>:
Hi:
I am using the following reqular expression to extract the last part ie
$lan
What do you get?
Try:
my $topdir = "common/default/l_cs";
# Find the part of the string that does not have a slash and is
followed by end of line
$topdir =~ /([^\/]+)$/; # Or should that read /([^/]+)$/ ?
my $lang = $1;
On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote:
Hi:
I am using the followi
Hi:
I am using the following reqular expression to extract the last part ie
$lang of the following string
$topdir = "common/default/l_cs";
my $lang=$topdir =~ /.*\/(.+)$/;
But it doesnt seem to work, what am i missing here?
Thanks!