Quick question -- script issue

Discussion in 'Perl' started by jack, Aug 24, 2003.

  1. jack

    jack Guest

    I pulled this script out of a larger one to test, and I can't figure it out.
    If I keep this script in the same directory as the files I want to read, it
    works fine, but if I move the script out of it, no dice. Am I missing
    something?

    Thanks

    Being script:
    #!/usr/bin/perl

    opendir(DIR, "/Users/jack/Sites/tempdir") || die "Can't open dir -- $!";
    @files = grep(/article.*\.toformat/, readdir(DIR));
    closedir(DIR);

    foreach $file (@files) {
    open(FILE,"<$file");
    my($template)=<FILE>;
    print "$template";
    close(FILE);
    }
     
    jack, Aug 24, 2003
    #1
    1. Advertising

  2. jack

    Guest

    jack <> wrote in message news:<BB6E7A1C.371%>...
    > Subject: Quick question -- script issue


    That contains _zero_ information. No, actually that's not true. It
    contains the information "I'm to selfish/lazy/arrogant to bother
    thinking about my subject lines". Is that really what you wanted to
    tell us?

    > I pulled this script out of a larger one to test, and I can't figure it out.
    > If I keep this script in the same directory as the files I want to read, it
    > works fine, but if I move the script out of it, no dice. Am I missing
    > something?


    Manuals.

    No less than half the manpage of one of the functions you are using is
    devoted to forewarning you about the mistake you have just made.
    Don't worry just about everyone makes the mistake the first time they
    use this funtion - I know I did. The test of character is if you have
    the self discipline to go RTFM when things go wrong.

    Guessing which function I'm talking about is left as an execise for
    the reader. (Hint, it is one that has something to do with
    directories).

    This newsgroup does not exist (see FAQ). Please do not start threads
    here.
     
    , Aug 28, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    Quick Starts - <script> vs code behind

    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jan 30, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    385
    HongQuan Wu[MSFT]
    Feb 2, 2006
  2. JKop
    Replies:
    11
    Views:
    937
  3. Jose  Reckoner
    Replies:
    1
    Views:
    565
  4. Jürgen Exner

    Re: Quick perl script-regex question

    Jürgen Exner, Nov 4, 2011, in forum: Perl
    Replies:
    0
    Views:
    2,015
    Jürgen Exner
    Nov 4, 2011
  5. Replies:
    3
    Views:
    210
    Josef Moellers
    Nov 1, 2007
Loading...

Share This Page