wvanthony
asked on
Unable to generate output from an array substring
Hi - I am working with an array substring, and have been unable to pull data from it....the code in question appears below:
#!/usr/bin/perl
#
# by: Michael D. McClellan
$gameschedule_file = "/www/htdocs/calendar/game schedule.t xt";
$gamelist_file = "/www/htdocs/calendar/game list.txt";
open(GAMESCHEDULE,"$gamesc hedule_fil e");
@gameschedule_test = <GAMESCHEDULE>;
close(GAMESCHEDULE);
$gameschedule_test = $gameschedule[0];
print $gameschedule_test;
print "Hello World!";
exit;
The format of the gameschedule.txt file is:
002%%307
003%%308
004%%312
005%%314
006%%316
007%%318
What I am trying to do is return the first line (002%%307) via print...once I can do this, then I will replace the print command with a variable and strore the value there (and continue coding the program)....I've looked at some sample code, and it looks like mine matches, but I'm not getting anything to return....any assistance would be greatly appreciated....thanks in advance for your help in this matter...
#!/usr/bin/perl
#
# by: Michael D. McClellan
$gameschedule_file = "/www/htdocs/calendar/game
$gamelist_file = "/www/htdocs/calendar/game
open(GAMESCHEDULE,"$gamesc
@gameschedule_test = <GAMESCHEDULE>;
close(GAMESCHEDULE);
$gameschedule_test = $gameschedule[0];
print $gameschedule_test;
print "Hello World!";
exit;
The format of the gameschedule.txt file is:
002%%307
003%%308
004%%312
005%%314
006%%316
007%%318
What I am trying to do is return the first line (002%%307) via print...once I can do this, then I will replace the print command with a variable and strore the value there (and continue coding the program)....I've looked at some sample code, and it looks like mine matches, but I'm not getting anything to return....any assistance would be greatly appreciated....thanks in advance for your help in this matter...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Once again, you rock! $gameschedule_test = $gameschedule_test[0]; is what I meant to say - that solved the problem....thanks!