perl.beginners
  Home FAQ Contact Sign in
perl.beginners only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
perl.beginners Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  one liner for for and if         


Author: Richard Lee
Date: May 8, 2008 15:25

#!/usr/bin/perl

use warnings;
use strict;

my @array = qw/one two three four/;

print "$_\n" for @array last if "$_" eq q/three/;

[root@server tmp]# ./!$
././././testthis2.pl
syntax error at ././././testthis2.pl line 8, near "@array last "
Execution of ././././testthis2.pl aborted due to compilation errors.

Can someone fix my last statement on this program?

I thought maybe this will work but guess not... is there no easy way
to do this?

I don't want to do

for (@array) {
if .......
}
}

just trying to see what the correct format is that for one liner that I
am trying
Show full article (0.63Kb)
4 Comments
  error in printing unicode         


Author: Vlad Stanimir
Date: May 8, 2008 10:32

I just finished reading "Beginning Perl by Simon Cozens Chapter 1: First
Steps In Perl" and i tried to print a Unicode character using the \x{}
but i got a strange outcome i don't understand.
The code was:

#!/user/bin/perl
use warnings;
print "\x{2620}\n";

and the result was:

Wide character in print at C:\Documents and
Settings\Vlad\desktop\test.plx line 3.
?ÿá

I used windows xp
cmd.exe
and i have activeperl 5.10.0 build 1002
2 Comments