Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!oliveb!veritas!amdcad!sono!porky!mayer From: mayer@sono.uucp (Ronald &) Newsgroups: comp.lang.perl Subject: unpack('x10','') Message-ID: Date: 26 Jun 91 18:01:04 GMT Sender: mayer@sono.uucp (Ronald Mayer) Distribution: comp Organization: Acuson; Mountain View, California Lines: 28 Inconsistancy with man page. Quoting from the man page: > Here's a subroutine that does substring: > sub substr { > local($what,$where,$howmuch) = @_; > unpack("x$where a$howmuch", $what); > } > however using the builtin: print "##",substr('hi',10,10),"##" gives me "####". but using the procedure as printed in the man page: print "##",&substr('hi',10,10),"##" dies with an error "x outside of string at - line 3." Could someone tell me which behavior is 'correct'? Ron mayer@sono.uucp [Didn't someone recently summarize part of the perl philosophy as being "never cause an error; just return null and let the programmer set up whatever error conditions he wants?] perl version 4.0 patchlevel 3 - sparc, sunos 4.1.1