brian54321uk wrote:
Rob Dixon wrote:
brian54321uk wrote:
Hi, I'm stuck with what will probably turn out to be a simple solution, I've been scouring google for ages, and can't find anything close to what I'm looking for.

Given that

$fred = 10
$barney = abcdefghijklmn

how do I get $wilma = j

my $wilma = substr $barney, $fred-1, 1;

Rob


Taking this one step further, if I may.
If foldername 10 does not exist, but j.txt does exist, what would be the simplest way of using a combo of mkdir and copying j.txt to the newly created foldername 10 ?

Thanks again.
Brian



I've managed to sort out the directory problem with:

if( -d $fred)
{
#dir exist
print "directory: $fred exists already\n";
die;
}
#dir not-exist
else {
        mkdir $fred;
print "directory: $fred has been created\n";
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to