CrazyEngineers
  • slinky773
    slinky773

    MemberAug 19, 2011

    Some Help?

    If I was a college student, I wouldn't be asking for CS help here, but I'm not a college student, now am I?

    I need some help with programming theory. When I make programs, I always give it a UI (as much as you can make a UI in a command prompt) and I ask the user (me, most of the time) to enter stuff.

    However, I have a bit of a problem. I cannot make my programs flexible. For example, I am trying to make a program in Perl to go through files that the user specifies and puts the lines it finds in all the files into another file. However, the problem is that I can't make it so there is no file limit. In this kind of situation, i would make all these if () { } elsif() { } blah blah blah statements, but I want the software to be simple. Like, it would just call a subroutine and pass this parameter containing the number of files, and it would just go through the files just like that. However, I'm relatively new to programming, and I can't really do that kind of stuff yet. So I will have to make crazy if() { } elsif() { } statements. But I don't want to do that. And that's why I'm asking you guys for help.

    This is the code so far, which is very unfinished.

    #!/usr/bin/perl -w
    use strict;
    use warnings;
    
    
    print "I will go through files and find lines that\n";
    print "occur in all lists. I will put the lines that\n";
    print "occur in all lists in another file.\n";
    print "How many lists do you have?\n";
    
    
    my $fileNumbers = ;
    
    
    &iterating($fileNumbers);
    
    
    sub iterating
    {
        print "What are those $fileNumbers file names?\n";
        print "Type them in one by one.\n";
    }
    
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • slinky773

    MemberAug 21, 2011

    er, bump? Please?
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register