[EMAIL PROTECTED] am Freitag, 9. Februar 2007 14:11: > I just found this one online but not sure I understand it > > what are the .{ and s/ called so I can look them up? > > http://user.it.uu.se/~matkin/programming/PERL/perl-cookbook.shtml > > perl5 -p000e 'tr/ \t\n\r/ /;s/(.{50,72})\s/$1\n/g;$_.="\n"x2' > > >perl -n00e'tr/\n/ /; print "$1\n" while s/^(.{0,69}\S)\s+//; print "\n"'
If you speak about this part: s/(.{50,72})\s/$1\n/g .{50,72} belong together. {} is one of the possible quantifiers. It means (in this case, without the /s modifier): "match any sequence of characters (except newline) of minimal length 50 and maximal length 72" There are two 's/' combinations in the expample: The first is part of the 's///' construct, meaning it's a substitution. In the second, '\s' belong together (without the following '/'). '\s' means "white space character". You can read all about this by typing perldoc perlre on the command line Hope this helps! Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/