Hi, Im trying to modify a script that uses strict "refs". I assigning a number" to a particular variable thats being used elsewhere. when I try to run the modified script, I get
Can't use string ("0") as a SCALAR ref while "strict refs" in use at ./xxxx.mod line 325
I was able to bypass it by issuing "no strict refs" right before the point where it is being used, but would like to not make such a change that could potentially impact other things. alternately id like to conform to the strict "refs" and convert the string to a SCALAR as required by the script. any idea how I can accomplish this?
Original content restored above by GrandFather. Updated content follows
I tried out kyle suggestion of putting a '\' before the $processor but got the error message
Processor is SCALAR(0x15f1a8) and qmgr is QM_P266
In bind_cpu_solaris , Processor is SCALAR(0x15f1a8)
In for loop ...
In Next Loop ...
/usr/sbin/pbind: must specify at least one pid
usage:
/usr/sbin/pbind -b processor_id pid[/lwpids] ...
The processor variable is populated in one other location where it looks for pid's of other processes already bound to a specific processor and tries to bind to the same (i.e populate $processor with the same proocessor id). the code is like the below:
sub get_cpu_used_by_other_processes
{
my $other_process = shift;
my $proc_id = locate_process_id( $other_proc );
my $processor = undef;
my $pid = undef;
my @cmd_output = `$os_command_table{$^O}{pbind} -q 2>/dev/null
+`;
die "ERROR:failed to retrieve the bound processors\n" unless (
+ $? == 0 );
##### increase the weight of processors based on used or not #
+####
foreach ( keys %{$proc_id} )
{
$pid = $$proc_id{$_};
next unless defined $pid;
foreach ( @cmd_output )
{
$processor = $1, return \$processor if /proces
+s\s+id\s+${pid}\s*:\s*(\d+)
$/;
}
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.