Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by TheDauntless

  1. TheDauntless

    Creating file doesnt work

    I can't find a backup file which has the getDate() still in it. But there's a change that I did indeed use a character that's not aloud in filenames... Too bad I can't tell for sure. Thanks for all your help though!
  2. TheDauntless

    Creating file doesnt work

    That's what I thought... Maybe it was just Komodo screwing up the outputs / errors ... :)
  3. TheDauntless

    Creating file doesnt work

    I kind of fixed it. $name was made by concatenating a string with the result of a function that got the date(), but apparently, getting the date takes some time to work? (The prints before the open() command were printed after the error :S). I removed the date and now it works :) Sorry for...
  4. TheDauntless

    Creating file doesnt work

    Hi, I'm trying to do something really simple, but it just won't work: How can I create an empty file (fe .txt), and close it without writing anything in it? I've tried this: open(ORDER, ">$name") or die $!;But then it says: I've tried a lot of other things, like: open(ORDER, "+>", "$name")...
  5. TheDauntless

    Global symbols requires explicit package name

    Aha! That's interesting! I'm going to try that :)
  6. TheDauntless

    Global symbols requires explicit package name

    The same error as before; the one in the topic title :) "Global symbol XXXXX requires explicit package name" I now tried this: $Main::counter = 1; That seems to help. Is this supposed to be used like that?
  7. TheDauntless

    Global symbols requires explicit package name

    If I don't write the 'my ' it gives the same error at that line. my $status = undef; sub listenForMenuChoice { print "Geef uw keuze en druk op enter.\n"; my $choice = <>; chop $choice; print "\n"; use Switch; switch ($choice) { case "1" {...
  8. TheDauntless

    create file handle from within sub in main scope

    Funny, that's something I often tell other people (on a different forum :p) It's just that scope handling in Perl is quite confusing, but thanks for your answer, it's a bit clearer to me now ;)
  9. TheDauntless

    Global symbols requires explicit package name

    Ok, got that :). But I still have a question concerning the scope issue. Little example: my $status = 0; sub sub1 { my $status = 1; &sub2; } sub sub2 { print my $status; } &sub1; The idea is that all those $status'es should point to the same $status (the one declared in line 1). How do I do...
  10. TheDauntless

    create file handle from within sub in main scope

    Example: sub mySub { open(MYFILE, "> path"); } Is <MYFILE> accessible from everywhere in my code now? (Without having declared MYFILE outside the subroutine)
  11. TheDauntless

    create file handle from within sub in main scope

    Hi, I'm wondering how I can create a file handle from within a sub routine, that is available in the entire document. In my routine, there is, fe: open (MYFILE,"> /test/output.txt"); How can I declare the (empty) scalar/variable in my main scope, so that I can 'fill it' from within my...
  12. TheDauntless

    Global symbols requires explicit package name

    I have the same case statement twice because I was in the middle of copy pasting when I posted the script :p. Why do I need a return? I have declared '$status' in the main part (so not inside a routine). I just need to access THAT $status from within a routine. (Just like you would access...
  13. TheDauntless

    Global symbols requires explicit package name

    Ah, I get it! So I changed those lines to: my $choise = <>; chop my $choice; And the error is gone. Now I get another error (well, same error, different place). I'm getting it at the $status = 1; in the switch. How can I access the global variable? Also: is "glob $status = undef;"...
  14. TheDauntless

    Global symbols requires explicit package name

    Hey, I keep getting this error with the following code: #!/usr/bin/perl -w use strict; sub mainMenu { print "Kies een optie (1-7)\n"; &listenForMenuChoice; } sub listenForMenuChoice { local($choice); $choice = <>; chop $choice; use Switch; switch...

Part and Inventory Search

Back
Top