read_fits_keyword (version 1.0)
You can also look at:
#! /usr/bin/perl
##############################################################################
#
# SYNTAX: read_fits_keyword file keyword
#
# DESCRIPTION: This utility reads a FITS keyword value and writes it to the
# DESCRIPTION: standard output.
#
# VERSION: 1.0
#
# HISTORY: 0.0 -> 1.0 1999-05-07
# HISTORY: Converted from ksh to perl
#
# CALLS: $UTIL/setup_parfile
# CALLS: $UTIL/read_parfile
# CALLS: $FTOOL/fkeypar
#
##############################################################################
($file, $keyword) = @ARGV;
$UTIL = $ENV{"UTIL"};
$FTOOL = $ENV{"FTOOL"};
if ( ! "$file" ) {
$file = "undefined";
}
if ( ! "$keyword" ) {
$keyword = "undefined";
}
`$UTIL/setup_parfile $FTOOL/fkeypar.par fitsfile="$file" \\
keyword="$keyword"`;
`$FTOOL/fkeypar >stdout${$}.log 2>stderr${$}.log`;
$code = $?;
chomp($value = `$UTIL/read_parfile ./fkeypar.par value`);
############################################
# strip single quotes and trailing blanks
############################################
$value =~ s/^\`//;
$value =~ s/ *\'$//;
print "$value\n";
`$UTIL/ftool_test fkeypar $code $0 1 stdout${$}.log stderr${$}.log`;
exit 0;