由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Anyway to stop perl subroutines reading outside variable
相关主题
请看看这个Perl random sampling code 有什么问题,register variable
再 次 请 教 : 关 于 writing to a file 用 Perl for CGIlambda的一个疑问
这个perl的简单小程序为什么不work? (转载)sql 数据是存在哪里 (转载)
perl eval and ifHow are parameters passed between ANSI C subroutines?
perl oneliner hash疑问QuickBasic grammer question
perl debugger 请较大虾们如何在fortran中定义一个动态的数组?
诚心请教Perl:简单的Variable Match in Regular expression问个fortran的问题
请教Fortran编程高手并问一下OpenMP的问题问个有关Perl Subroutine 转换到Module的问题
相关话题的讨论汇总
话题: anyway话题: use话题: stop话题: read
进入Programming版参与讨论
1 (共1页)
f******y
发帖数: 2971
1
For example, I dont want the following script to compile. One way to do it
is to put all subroutines to the head of the file. That is not convenient
most of time. I tried to use another package, it still can read $a.
use strict;
my $a = 0;
package Function; #This does not stop it.
sub read {
return($a + 1);
}
f******y
发帖数: 2971
2
Another ugly way to do it. This is still not nice. I want to know if there
is something we can declare in use clause, something like:
use xxxxxx;
{
use strict;
my $a = 0;
}
sub read {
return($a+1);
}

【在 f******y 的大作中提到】
: For example, I dont want the following script to compile. One way to do it
: is to put all subroutines to the head of the file. That is not convenient
: most of time. I tried to use another package, it still can read $a.
: use strict;
: my $a = 0;
: package Function; #This does not stop it.
: sub read {
: return($a + 1);
: }

1 (共1页)
进入Programming版参与讨论
相关主题
问个有关Perl Subroutine 转换到Module的问题perl oneliner hash疑问
setjmp() and longjmp()perl debugger 请较大虾们
FORTRAN 90 菜鸟问题诚心请教Perl:简单的Variable Match in Regular expression
怎样解决fortran程序中的common块的问题请教Fortran编程高手并问一下OpenMP的问题
请看看这个Perl random sampling code 有什么问题,register variable
再 次 请 教 : 关 于 writing to a file 用 Perl for CGIlambda的一个疑问
这个perl的简单小程序为什么不work? (转载)sql 数据是存在哪里 (转载)
perl eval and ifHow are parameters passed between ANSI C subroutines?
相关话题的讨论汇总
话题: anyway话题: use话题: stop话题: read