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 = ;


sub iterating
    print "What are those $fileNumbers file names?\n";
    print "Type them in one by one.\n";


  • slinky773
    er, bump? Please?

You are reading an archived discussion.

Related Posts

Starting from 20th August, from evening 6 pm to midnight, there will be 10 quiz/logic questions everyday. They will be really easy, but the catch is to answer them quickly....
Name:Sagar Rathod Location: Nagpur Occupation: Student Branch: Information Technology Year: 3rd Work Experience: Working with VPN service and part of a team NUTS Hobbies & Interests: Hacking is in my...
i h8 EEE but i am forced 2 study it...... so PLZ help me.
It is now almost everyday, that I come across the word apps. I am bewildered by what does an *app* mean? What are their purpose? Can we have a discussion...
This post is the guide for following my tutorials on C-Programing. ************************************************************************************************************* Please donot post questions/appreciations/criticisms/suggestions in the thread dedicated to tutorial. If you want to suggest something personally, the...