Home: Perl Programming Help: Regular Expressions:
split function



perlnewer
Novice

Oct 12, 2010, 2:24 AM


Views: 5303
split function

871066-871069.doc


how to split this file into two files after '-' with .doc extension and insert into db?


tej.87g
Novice

Oct 13, 2010, 11:40 PM


Views: 5255
Re: [perlnewer] split function

Try this,

Probably this may help you..


Code
#usr/bin/perl 

my $file="871066-871069.doc";
my $file1;
my $file2;
if ($file=~m{(\d+)\-(\d+\.doc)}) {
$file1=$1.".doc";
$file2=$2;
}
print "$file1\n$file2\n";



perlnewer
Novice

Oct 14, 2010, 11:04 PM


Views: 5245
Re: [perlnewer] split function

thank u it's work fine