You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No plans to support it currently. I don't know enough about Perl, and 'm scared of the language's syntax ;-) Also, what to support, Perl 5 or 6?
Patches are very welcome, but we need a LOT of example code to make sure it doesn't crash even on the most hideous Perl code. Forking the Ruby scanner might be a good start.
I'd personally be interested in a Perl 5 scanner.
I would suggest if a scanner were added for either version that both be kept in parallel as perl 6 and perl 5 are fairly different languages and have different futures at the moment. If perl 6 ever really replaces perl 5 I expect that will be many years from now.
Thanks for the link... when I tried to look at that site before it seemed to not be working... i kept getting the same message on every page. It looks to be working now, so I'll take a look at it sometime.
#!/usr/bin/perl -w
# comments start with #
# first line can be treated as comment but it's a shebang
use strict;
=head1 DESCRIPTION
Here are samples of Perl code.
This chunk is POD - Plain Old Documentation,
it can contain B<bold>, I<italic>, C<code>, links L<http://example.net>,
entitites E<gt>, filenames F<.bashrc>.
POD starts from =word which haven't any chars before.
Words =pod, =head1, =head2, =head3, =head4, =over, =item, =back, =begin, =end, =for,
and =encoding are marking begin of section; word =cut ends any section.
=head1 SEE ALSO
L<perlpod> or L<< http://perldoc.perl.org/perlpod.html >>
=cut
my $scalar = 42;
my @list = ( 'alice', 'bob', 3.1415926 );
my %hash = ( bare => 7, 'key' => $scalar );
my $refs = {
'scalar' => \$scalar,
'list' => \@list,
'hash' => \%hash,
};
my $aref = \@list;
# Function with parentheses
print
join(' ', $list[1], $hash{'bare'}, $refs->{list}->[3]),
"string can contain variables like $scalar and characters\n",
qq{can\x20too}, qq=and too\cJ=,
`uname -a`, qx<df -h>;
# and without them
my @fruits = qw/ apple banana cucumber duck elephant /;
print
sort { $b cmp $a }
grep { /a/ } @fruits;
# if can be used without parentheses too
printf
"%f = %f. File %s, line %d\n",
$$aref[2], $aref->[2], __FILE__, __LINE__
if $#list == 2;
# Regular expressions
$list[1] =~ s/b/Bh/g
if $list[0] =~ /i/
&& $list[1] =~ m-o-;
my @regexps = ( /\d+/, qr{\w} );
LABEL:
foreach ( @fruits ) {
# implicit using of $_ variable
next LABEL if /c/;
print;
}
Here are Perl's functions (including things that look like functions, like some keywords and named operators) arranged by category. Some functions appear in more than one place.
Keywords related to the control flow of your Perl program break, caller, continue, die, do, dump, eval, evalbytes, exit, __FILE__, goto, last, __LINE__, next, __PACKAGE__, redo, return, sub, __SUB__, wantarray
Keywords related to scoping caller, import, local, my, our, package, state, use
System V interprocess communication functions msgctl, msgget, msgrcv, msgsnd, semctl, semget, semop, shmctl, shmget, shmread, shmwrite
Fetching user and group info endgrent, endhostent, endnetent, endpwent, getgrent, getgrgid, getgrnam, getlogin, getpwent, getpwnam, getpwuid, setgrent, setpwent
"string with interpolated $variables\n", qq{more}, qq/and more/,
'without them', q{without}, q/them/, q^any symbol after q is OK^, q<but brackets must be paired>,
42, 3.1415926, 1e6, 16_777_216, 012 (octal), 0xFF and 0xff (hexadecimal)
Can a double quoted string contain a newline?
my $multiline = "Yes,
it can.";
rules for comments
# There is a comment
$var = 42; # life, the Universe, and everything
Does Language have a special syntax for multiline comments?
Activity
korny commentedon Sep 2, 2012
No plans to support it currently. I don't know enough about Perl, and 'm scared of the language's syntax ;-) Also, what to support, Perl 5 or 6?
Patches are very welcome, but we need a LOT of example code to make sure it doesn't crash even on the most hideous Perl code. Forking the Ruby scanner might be a good start.
korny commentedon Sep 2, 2012
Oh, and, as always, I direct you to http://odd-eyed-code.org/projects/coderay/wiki/ScannerRequests.
rwstauner commentedon Sep 2, 2012
I'd personally be interested in a Perl 5 scanner.
I would suggest if a scanner were added for either version that both be kept in parallel as perl 6 and perl 5 are fairly different languages and have different futures at the moment. If perl 6 ever really replaces perl 5 I expect that will be many years from now.
Thanks for the link... when I tried to look at that site before it seemed to not be working... i kept getting the same message on every page. It looks to be working now, so I'll take a look at it sometime.
Thanks.
korny commentedon Sep 3, 2012
So we should implement a Perl 5 scanner, and make sure it doesn't totally mess up if you give it Perl 6 :-)
Sorry -.-' I guess that's because we recently upgraded to Ruby 1.9…you know how it goes.
kissifrot commentedon Nov 18, 2013
Hello, any news on this? :-)
korny commentedon Nov 18, 2013
No progress yet, sorry. I'll announce here when there's anything new.
shoorick commentedon Sep 24, 2016
Sample of simple Perl code:
As written in http://odd-eyed-code.org/projects/coderay/wiki/ScannerRequests
http://perldoc.perl.org/perlfunc.html
Here are Perl's functions (including things that look like functions, like some keywords and named operators) arranged by category. Some functions appear in more than one place.
chomp
,chop
,chr
,crypt
,fc
,hex
,index
,lc
,lcfirst
,length
,oct
,ord
,pack
,q//
,qq//
,reverse
,rindex
,sprintf
,substr
,tr///
,uc
,ucfirst
,y///
m//
,pos
,qr//
,quotemeta
,s///
,split
,study
abs, atan2, cos, exp, hex, int, log, oct, rand, sin, sqrt, srand
@ARRAYs
each
,keys
,pop
,push
,shift
,splice
,unshift
,values
grep
,join
,map
,qw//
,reverse
,sort
,unpack
%HASHes
delete
,each
,exists
,keys
,values
binmode
,close
,closedir
,dbmclose
,dbmopen
,die
,eof
,fileno
,flock
,format
,getc
,print
,printf
,read
,readdir
,readline rewinddir
,say
,seek
,seekdir
,select
,syscall
,sysread
,sysseek
,syswrite
,tell
,telldir
,truncate
,warn
,write
pack
,read
,syscall
,sysread
,sysseek
,syswrite
,unpack
,vec
-X
(see below),chdir
,chmod
,chown
,chroot
,fcntl
,glob
,ioctl
,link
,lstat
,mkdir
,open
,opendir
,readlink
,rename
,rmdir
,select
,stat
,symlink
,sysopen
,umask
,unlink
,utime
break
,caller
,continue
,die
,do
,dump
,eval
,evalbytes
,exit
,__FILE__
,goto
,last
,__LINE__
,next
,__PACKAGE__
,redo
,return
,sub
,__SUB__
,wantarray
caller
,import
,local
,my
,our
,package
,state
,use
defined
,formline
,lock
,prototype
,reset
,scalar
,undef
alarm
,exec
,fork
,getpgrp
,getppid
,getpriority
,kill
,pipe
,qx//
,readpipe
,setpgrp
,setpriority
,sleep
,system
,times
,wait
,waitpid
do
,import
,no
,package
,require
,use
bless
,dbmclose
,dbmopen
,package
,ref
,tie
,tied
,untie
,use
accept
,bind
,connect
,getpeername
,getsockname
,getsockopt
,listen
,recv
,send
,setsockopt
,shutdown
,socket
,socketpair
msgctl
,msgget
,msgrcv
,msgsnd
,semctl
,semget
,semop
,shmctl
,shmget
,shmread
,shmwrite
endgrent
,endhostent
,endnetent
,endpwent
,getgrent
,getgrgid
,getgrnam
,getlogin
,getpwent
,getpwnam
,getpwuid
,setgrent
,setpwent
endprotoent
,endservent
,gethostbyaddr
,gethostbyname
,gethostent
,getnetbyaddr
,getnetbyname
,getnetent
,getprotobyname
,getprotobynumber
,getprotoent
,getservbyname
,getservbyport
,getservent
,sethostent
,setnetent
,setprotoent
,setservent
gmtime
,localtime
,time
,times
and
,AUTOLOAD
,BEGIN
,CHECK
,cmp
,CORE
,__DATA__
,default
,DESTROY
,else
,elseif
,elsif
,END
,__END__
,eq
,for
,foreach
,ge
,given
,gt
,if
,INIT
,le
,lt
,ne
,not
,or
,UNITCHECK
,unless
,until
,when
,while
,x
,xor
-X
are-r
,-w
,-x
,-o
,-R
,-W
,-X
,-O
,-e
,-s
,-z
,-f
,-d
,-l
,-p
,-S
,-b
,-c
,-t
,-u
,-g
,-k
,-T
,-B
,-M
,-A
,-C
.Yes, it have. See perlpod
There is a lot of unusual syntax and Ruby got some of its features :-)
('list', 'items')
or asqw( words without quotation marks )
,/regexp/
or asqr/regexp/
. There are modifiers for regexps. See perlrecommand
or asqx(command)
s///
,m//
,tr///
,y///
Hmmm... There is Perl 5 and Perl 6. But I propose to use Perl 5 only.