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

Help with default record separator 1

Status
Not open for further replies.

netman4u

Technical User
Mar 16, 2005
176
US
I have the following code that is not working. The problem seems to be with what I am redefining the default record separator to. I know I have done this before in a while loop to change the scope of what a record is defined as. Any help is appriciated.

Code:
use strict;
use warnings;
my $prefix		= shift @ARGV;
my $cpu			= shift @ARGV;
my $sched_name	= shift @ARGV;
my $job_name	= shift @ARGV;

open (CFG, "/home/mt71124/scripts/maestro_inst.txt") or die ("Error opening config file: $1");
$/ = &;
while (<CFG>) {
	next if /^\#/;
	next unless ($_ =~ /^$prefix\s+$cpu\s+$sched_name\s+$job_name\s+(\w+)/);
	print;
	exit;
}
print "Contact the application oncall for this prefix to remediate./n The workstation is $cpu the schedule is $sched_name the job is $job_name\n";

If at first you don't succeed, don't try skydiving.
 
if you print

my $prefix = shift @ARGV;
my $cpu = shift @ARGV;
my $sched_name = shift @ARGV;
my $job_name = shift @ARGV;

do they come back on a new line? If so, chomp (xxxxx) and also close CFG;
 
local $/ = '&';

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Thanks for the reply max but that is not it. It might help if I posted the output I am getting:

Code:
# ./maestro_inst.pl EW PRDAI085 #EWSRDBUD EWDBABKUP
syntax error at ./maestro_inst.pl line 17, near ") {"
syntax error at ./maestro_inst.pl line 22, near "}"
Execution of ./maestro_inst.pl aborted due to compilation errors.

Could the "#" in my input argument be causing problems?

If at first you don't succeed, don't try skydiving.
 
That did it Kevin

If at first you don't succeed, don't try skydiving.
 
please don't go skydiving netman [wink]

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Haa! [tongue] No worries there! You won't see me jumping out of a plane!

If at first you don't succeed, don't try skydiving.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top