I very new to all this so please bear with me. (This is also my first post). I am trying to add files from a directory to an array, which I learnt last night from reading on this site that I could do by
@allcontacts = <*.cd>;
That was fantastic and I also learnt that I could use something like
@allcontacts = <a_directory/*.cd>;
However I now want to use a variable to in place of the a_directory/*.cd
I tried doing this with the following code...
#set the initial values for the text boxes to the first contact's det
#cd32/ is the directory
$searchcontacts = "cd32/*.cd";
@allcontacts = <$searchcontacts>;
$count = "0";
#display the first files contents first
open(DAT, $allcontacts[$count]) || die("Could not open file!");
But received the message unable to open the file. As it worked fine before I put the variable in I know it has something to do with this.
I have tried escaping the characters but I am obviously doing something wrong. I am sure there is a simple answer, but I have looked for ages, and just feel really stupid. I would greatly appreciate it if some wise monk would impart some of their wisdom to me.