Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: format with tilde Message-ID: <11526@jpl-devvax.JPL.NASA.GOV> Date: 21 Feb 91 01:52:04 GMT References: <91049.163743FFAAC09@cc1.kuleuven.ac.be> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 47 In article <91049.163743FFAAC09@cc1.kuleuven.ac.be> FFAAC09@cc1.kuleuven.ac.be (Paul Bijnens) writes: : I have a problem using single and double tilde in formats. : I have a file with each line consisting of 20 fields separated by : a tab. Most of the fields are blank, some are short and the rest : is very long (up to 1000 chars or more). : For printing this out, I wanted to use perl (what other program : does not choke on such long lines?). A little skeleton of the : program (which does also some other things) follows: : : -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- : format = : ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< : $Xword : ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~ : $Xvd : ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ : $Xvd : ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~ : $Xhn : ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ : $Xhn : ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~ : $Xdh : ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ : $Xdh : ------------------------------------ : . ... : Instead of just repeating the line with two tildes, it : repeats the pair of lines. : What do I do wrong? Or isn't the format intended to be used : for this purpose? No, it should work, but it doesn't. You're the first person who's ever put a ~~ line directly after a ~ line, apparently. Anyway, I found the bug, so it'll be fixed in 4.0. : Btw, in perl.4.0, beta release in lib/look.pl, we find: : ;#Usage: &look(*FILEHANDLE,$key,$dict,$fold) : and a little bit further: : local(*FH,$key,$fold,$dict) = @_; : ... If in doubt, look at the code... But the code will change to match the documentation in this case, since the book has it the other way around. Larry