Hi guys,
I wrote this perl script to create thousand of folders by reading from a text file a number, for instance for the numbers 12123131212 * 3238233272 , I need to create the folder 1/2/1/2/12123131212/US_English and 3/2/3/8/3238233272/US_English. The problem is that the last part is not being concatenated properly. Please take a look on the code and output. For some reason, only the last number in my txt is getting concatenated correctly. Please advise
Thanks alot.
---------------------------------------------------------------------
Output:
1\2\1\2\12123131212
\8000\US_English
3\2\3\8\3238233533
\8000\US_English
5\4\5\6\5456546456
\8000\US_English
4\5\3\3\4533535355\8000\US_English
----------------------------------------------------------
#!/usr/local/bin/perl
#
# Program to do the obvious
#
open FILE, "ali.txt" or die $!;
while (my $line = <FILE>)
{
$foldername=$line;
$FirstVar = substr($line,0, 1);
$SecondVar = substr($line,1, 1);
$ThirdVar = substr($line,2, 1);
$FourthVar = substr($line,3, 1);
$FifthVar="8000\\US_English";
$NewDirectory =$FirstVar."\\".$SecondVar."\\".$ThirdVar."\\".$FourthVar."\\".$line."\\".$FifthVar;
print ($NewDirectory);
print"\n";
}
I wrote this perl script to create thousand of folders by reading from a text file a number, for instance for the numbers 12123131212 * 3238233272 , I need to create the folder 1/2/1/2/12123131212/US_English and 3/2/3/8/3238233272/US_English. The problem is that the last part is not being concatenated properly. Please take a look on the code and output. For some reason, only the last number in my txt is getting concatenated correctly. Please advise
Thanks alot.
---------------------------------------------------------------------
Output:
1\2\1\2\12123131212
\8000\US_English
3\2\3\8\3238233533
\8000\US_English
5\4\5\6\5456546456
\8000\US_English
4\5\3\3\4533535355\8000\US_English
----------------------------------------------------------
#!/usr/local/bin/perl
#
# Program to do the obvious
#
open FILE, "ali.txt" or die $!;
while (my $line = <FILE>)
{
$foldername=$line;
$FirstVar = substr($line,0, 1);
$SecondVar = substr($line,1, 1);
$ThirdVar = substr($line,2, 1);
$FourthVar = substr($line,3, 1);
$FifthVar="8000\\US_English";
$NewDirectory =$FirstVar."\\".$SecondVar."\\".$ThirdVar."\\".$FourthVar."\\".$line."\\".$FifthVar;
print ($NewDirectory);
print"\n";
}