Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Matching first Perl statement.

by Albannach (Monsignor)
on Jan 15, 2002 at 19:37 UTC ( [id://138923]=note: print w/replies, xml ) Need Help??


in reply to Matching first Perl statement.

Since it seems clear that a simple (or even highly complex) regex isn't going to appear and solve this (I think even japhy is a few months from building an entire Perl interpreter in a single regex ;-), I offer this trivial attempt for your amusement. At least it is an out of the box solution, but it will not work for all of the examples offered in this thread. I had some fun testing it if nothing else!
my $firstline = (`perl -MO=Deparse $0 2>nul`)[2]; print "\nThe first line of Perl code is:\n$firstline"; # first test: $x = sin / 25 ; # /; die "Bang! I'm dead!"; $y = time / 25 ; # /; die "I'm only pretending!";
produces:
The first line of Perl code is: $x = sin / 25 ; # /; Bang! I'm dead! at D:\Perl\dl\debug\testsource.pl line 19.

--
I'd like to be able to assign to an luser

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://138923]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found