in reply to use variable as name for new file

You could help us all by using <code></code> tags. Your print statments look a little crazy right now. Then \n will do the new line you dont need to include a newline in it as well.

$name = $subject; needs a my in front of it just like the declerations above it. You also need to uncomment the line that is printing the header.


___________
Eric Hodges

Replies are listed 'Best First'.
Re^2: use variable as name for new file
by Zcity (Novice) on Jun 16, 2006 at 14:58 UTC
    Thanks. Now I did the change as you stated. Now Im getting this:

    Insecure dependency in open while running with -T switch at /pw/data/PWWWDEVL/cgi-bin/eng/strudyn/devl/survey/zal/createfile.cgi line 27.

      Thats perls way of telling you that you are trying to open a file with a name supplied by a user and you REALY REALY don't want a user to be able to open any file they want. So at very least you need to check the file name coming from the user and verify that it is okay to open, but better would be to figure out how not to have the user specify the file name.


      ___________
      Eric Hodges
        Thanks everyone for helping. This is the code that worked for me:
        ################
        open (LOG,">pending/" . $subject) or die("Error in opening the file :$!:");
        ########to replace space with underscore between text#####
        $subject =~ s/ /_/g;
        ############################
        Bad news indeed.

        Also. If your going to create a file for each subject of every post. You're going to have alot of files in there ;)