|
-
Jul 17th, 2002, 08:46 PM
#1
Thread Starter
Hyperactive Member
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
-
Jul 26th, 2002, 08:12 AM
#2
Frenzied Member
not a bug in PERL, a bug in the script. If you just want to print the contents of a dir why not just print it instead of trying to hand it off to a sub?
my $root = "e:\\";
opendir(DIR, "$root");
@files = sort(readdir(DIR));
closedir(DIR);
foreach (@files) {
print "$_<br>\n";
}
if you really want to use the sub, maybe something like this:
sub printArray {
my @array = @_;
my $prefix = (defined $_[1])? $_[1]: "";
foreach my $item (@array) {
print $prefix.$item."\n";
}
}
-
Sep 29th, 2002, 05:02 PM
#3
Thread Starter
Hyperactive Member
Originally posted by phpman
not a bug in PERL, a bug in the script. If you just want to print the contents of a dir why not just print it instead of trying to hand it off to a sub?
how is that an error in the script? its just seems like a difference in approach to me... the sub that i was passing it to formated the output and did our tasks that were core to the prog.
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
-
Oct 3rd, 2002, 06:03 PM
#4
Frenzied Member
jeez 2 months later. 
difference in approach but mine doesn't seem to be a bug.
if they are so different then why complain about a bug in Perl.
-
Oct 7th, 2002, 09:22 PM
#5
Black Cat
Off the top of my head, I'm going to guess something like this would work.
Code:
sub printArray {
my $array = shift;
print $array->[0];
}
printArray (\@contents);
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Oct 7th, 2002, 11:45 PM
#6
Thread Starter
Hyperactive Member
i don't remember seeing a -. operator, what is it?
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
-
Oct 8th, 2002, 10:05 AM
#7
Black Cat
You mean -> - its a dereference operator, used heavlily in OO perl for calling methods of objects. But basically, you passed a scalar reference o the array, so you dereference the scalar to get at the array it references.
Code:
use CGI;
my $cgi = new CGI;
print $cgi->param('formfield');
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|