Home: Perl Programming Help: Regular Expressions:
Split doctor id from file name



padmahealthsoft
New User

Aug 25, 2010, 4:52 AM


Views: 6169
Split doctor id from file name

Hi

I am new to Perl.In my project Perl script used for download medical transcription files from client to our server.downloaded files automatically allotted to transcriptionst using Perl.my problem is how to split the doctor id from that files and how to check if particular doctor files are came and allotted that files to particular users.how to do that?i.e file name = N 0824-003 908000000 02 237144 .vox .in that 9080000 is doctor's id.
kindly help me.


(This post was edited by padmahealthsoft on Aug 25, 2010, 4:57 AM)


Zhris
Enthusiast

Aug 26, 2010, 9:58 PM


Views: 6109
Re: [padmahealthsoft] Split doctor id from file name

hey,


Quote

check if particular doctor files are came and allotted that files to particular users.


I'm unable to understand what you meant here. Also I think the doctor id you provided was 2 0's short of the actual doctor id?

In regards to splitting the filename to retrieve the "doctor id", you could simply use the split function:


Code
   
my $filename = 'N 0824-003 908000000 02 237144 .vox';
my ($part1, $part2, $doctorid, $part4, $part5, $extension) = split /\s+/, $filename;
print "$doctorid\n";


Chris


(This post was edited by Zhris on Aug 26, 2010, 10:01 PM)


rayapallisuresh
New User

Dec 14, 2010, 11:07 AM


Views: 5629
Re: [padmahealthsoft] Split doctor id from file name

to split the doctor id from a string like
my $string = "N 0824-003 908000000 02 237144 .vox"

code:
my $doc_id = ( split(/\s+/,$string) )[2];

logic:
take the third element of the list returned by split in list context.