I probably should have explained what this is doing, the match m// takes
the string in $test and (using the parenthesis for capturing), puts the
first character in $1, the second 4 characters in $2, the third 6
characters in $3, skips the dot and puts the last 3 characters in $4.
This relies on the string being exactly as specified by you (you said
the length does not change). No type checking is done so any 11
characters followed by a dot followed by 3 characters, will match. You
can check the m// for truth if required.

my $test = "Rnott230602.txt";
if ( $test =~ m/^(.{1})(.{4})(.{6})\.(.{3})$/ ) {
  $first_part = $1;
  $second_part = $2;
  $third_part = $3;
  $extension = $4;
}
else {
  print "It failed";
}

HTH
Nigel

>>> "Nigel Peck" <[EMAIL PROTECTED]> 07/02/02 09:01am >>>
my $test = "Rnott230602.txt";
$test =~ m/^(.{1})(.{4})(.{6})\.(.{3})$/;
my $first_part = $1;
my $second_part = $2;
my $third_part = $3;
my $extension = $4;

>>> <[EMAIL PROTECTED]> 07/02/02 08:23am >>>
Hi

filename    Rnott230602.txt

I want to break down the name and compare with other text, it breaks
down
as R / nott / 230602 (3 items)
the length does not change.

Now I know I can split() each char and combine into a string

Is there a smarter way ???

Any thoughts greatly appreciated

Steve




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from
disclosure
under applicable law.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to