Henry Wong wrote:
> 
> Actually, my code is something like this:
> 
> print "\n\n\nPLEASE ENTER REQUIRED .LOG FILE:";
> $file = <STDIN>;
> chomp ($file);
> open (INFILE1, "$file");
> 
> So how can I use the $file variable to be splitted from its *.log and then
> subsequently using it for appending to a "$file_temp.txt" format? Coz when i
> print the $file, it gives me "xxx.log", which i actually want. But i only
> want the front portion "xxx" and not the ".log" later when i create new
> files like 'xxx_temp.txt'. Pls advise, thanks.


use File::Basename;

print "\n\n\nPLEASE ENTER REQUIRED .LOG FILE:";
chomp( my $file = <STDIN> );
open INFILE1, $file or die "Cannot open $file: $!";

my ($name) = fileparse( $file, '\..*' );

my $temp_file = "${name}_temp.txt";




John
-- 
use Perl;
program
fulfillment

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

Reply via email to