Formaty

Honza Pazdziora adelton na informatics.muni.cz
Sobota Březen 29 23:10:05 MET 2003


On Tue, Mar 25, 2003 at 01:37:27PM +0100, Frantisek Darena wrote:
> 
> # vypisu, co z hodnot zbyde
> print "hodn1: $hodnota, hodn2: $hodnota2";
> 
> # vypise se
> hodn1: 123456789, hodn2: 56789
> 
> Pri vlozeni hodnoty pomoci ^ by se mely zobrazene znaky odstranit. Pri
> zarovnani pomoci ### to ale nefunguje. Delam neco spatne, nebo je
> to v poradku? Nikde jsem zatim vysvetleni nenasel. Dekuji za radu.
> F. Darena

No, v perlform se pise

       Picture fields that begin with ^ rather than @ are treated
       specially.  With a # field, the field is blanked out if
       the value is undefined.  For other field types, the caret
       enables a kind of fill mode.  Instead of an arbitrary
       expression, the value supplied must be a scalar variable
       name that contains a text string.  Perl puts as much text
       as it can into the field, and then chops off the front of
       the string so that the next time the variable is refer-
       [...]

tedy ctu to

	if (field =~ /^\^/) {
		if (field =~ /#/) {
			field = '' if value is not defined;
			# no chopping here
		} else {
			put_as_much and chop;
		}
	}

Cili to s tim orezavanim je v dokumentaci ve vete "For other field
types", pro # plati pouze ta prvni veta.

Vzhledem k tomu, ze se takto chova 5.6.* i 5.8.* bych to povazoval
za vlastnosti.

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
      ... all of these signs saying sorry but we're closed ...
------------------------------------------------------------------------


Další informace o konferenci Perl