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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. johndoe3344

    Regarding variable scope within conditionals

    I'm trying to make a program which has a menu doing two things: (1) Read data from an input file (2) Write certain pieces of the most recently read data to an output file (3) Exit The user needs to be able to keep repeating choice 1 for as long as he/she wants, and then use choice 2 to write...
  2. johndoe3344

    Opening a range of files with OPEN

    Yeah, you were right Miller, sorry about that. I left out a few periods.
  3. johndoe3344

    Opening a range of files with OPEN

    I have a list of files named 'test1.txt', 'test2.txt', 'test3.txt'... etc to 'test35.txt'. I want perl to open test1, perform some operation, then do the same to test2, and so on. This is my code fragment: ... ... for ($a = 1; $a <=35; $a++) { my $input = "test" . "$a" . ".txt"; open...
  4. johndoe3344

    Need help regarding divisible numbers

    Thank you very much Miller. I realized what I was missing now.
  5. johndoe3344

    Need help regarding divisible numbers

    Just that it's divisible by 2.
  6. johndoe3344

    Need help regarding divisible numbers

    No, this is not school/course work. I'm learning perl on my own, and I couldn't figure out a way to do this. I'm sorry about leaving the other threads hanging - I'll properly thank the people who help me and tell them that I solved my problem in the future.
  7. johndoe3344

    Need help regarding divisible numbers

    How would I test whether a number is divisible by a certain combination of numbers (say 2 and 3?) The number 4 fits, because it divides by 2, and then by 2. The number 12 fits, because it divides by 3, then by 2 twice. The number 15 doesn't fit because after dividing by 3, 5 is not divisible by...
  8. johndoe3344

    Regarding file outputs to different files

    Does the 'for' construct here serve the same purpose as a 'foreach'? Also do I need to predefine certain values in @array? Thanks.
  9. johndoe3344

    Regarding file outputs to different files

    I have a question on how to print to different files, say, out.1.txt, out.2.txt, etc. If i have open (OUTP, ">out.txt") print OUTP "$_"; in some sort of loop, then out.txt only stores the information in the last iteration of the loop because all the other attempts were overwritten. What I'm...
  10. johndoe3344

    Very short perl script - Why doesn't it work?

    When I try to use your code, I seem to get this message: Modification of non-creatable array value attempted, subscript -1 at testscript.pl line 15, INPUT line 1. Why is this?
  11. johndoe3344

    Quick question about filehandles

    The segment of code in question is: Let's say input.txt consists of the lines: file_name_1.txt file_name_2.txt file_name_3.txt What I want the script to do is open each of these files, and invoke a certain subroutine with each one. Would that work?
  12. johndoe3344

    Very short perl script - Why doesn't it work?

    Thanks a lot! But could you explain the use of this line: $array[-1] .= $input; What is the [-1]?
  13. johndoe3344

    Very short perl script - Why doesn't it work?

    Hi, I'm a newbie to perl. I just started learning it a few days ago. The short script that I made is: The file that it takes as input, sample.txt is something like as follows: What I want the script to do is to display only the numbers containing "KEYWORD" so for this case, I just want it to...

Part and Inventory Search

Back
Top