[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] What's error "chunk 7072"?



Xah Lee <xah@best.com> writes:
}Three beginner's easy questions:
}
}Question 1:
}Can anyone tell me what the following warning means?
}
}# Use of uninitialized value, <WEBLOG> chunk 7072.
}                               ^^^^^^^^^^^^^^^^^^
}
}I've checked on-line docs, but couldn't figure out why it came up and
}what's "chuck 7072". I was using "use stric" and "#!perl -w". Do I need to
}declare FILEDANDLES?

No.  No need to declare filehandles, unless you're worried about namespace
conflicts.  Then they should be localized:

local(*WEBLOG);

Of course, they only get associated with files through one of the open
statements.

}
}---------------------------------------------
}
}Question 2:
}
}How to write a subroutine that takes in a file name and returns true or
}false depending whether its extension is one of qw(m ma nb mov hqx). (I
}don't want a hard-wired ||...||...|| solution.)
}
}The following is my try, but didn't work.
}
}sub funct {
}	my($x);
}	$x = $_[0];
}	$x =~ s@^[^.]+\.(.+)$@$1@;
}	$x =~ m@m|ma|nb|mov|hqx@;  #this line is incorrect. I knew.
}};

Why do you say this doesn't work?  It seems to work for me for the few cases
I've tried.  I'd probably simplify it to:


sub funct {
	$_[0] =~ /\.(m|ma|nb|mov|hqx)$/;
}

which, if I understand you, should do what you want.

}---------------------------------------------
}Question 3:
}
}Can anyone tell me the location of on-line doc that explains the
}
}#!perl
}
}line? I knew roughly what it is and what it does, but would like to read
}about it. (I did grep the pod, but didn't find explainations)

It's a Unixism, that's convenient on the Mac for passing command line
switches, like -w.  You probably will have better luck if you grep for
/bin/perl.  On Unix, the #! tells the command interpreter that the string
after the #! (shebang) is the path of the program to start up and hand the
script to.  So you'll commonly see #!/bin/csh or #!/usr/local/bin/perl or
#!/bin/awk at the beginning of Unix scripts, depending on what kind of
scripts they are.


}
}Thanks for any hint.
}
} Xah, xah@best.com
} http://www.best.com/~xah/Wallpaper_dir/c0_WallPaper.html
}
}

---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch