![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |||
| [SOLVED] Using $ARGV[1] in PERL to open any text file for this program.? How can I use $ARGV[1] in replace of 'data.txt' or something like $ARGV[1] in this code: # PRO1.pl open (MYFILE, 'data.txt'); while (<MYFILE>) { chomp; print "$_\n"; } close (MYFILE); so that I can run any text file in this program. For example $ perl PRO1.pl part1.txt $ perl PRO1.pl part2.txt $ perl PRO1.pl part3.txt Do I have to change this code completely, or can I do something like replace 'data.txt' with '$ARGV[1]'. |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |