Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Regex "(un)Knowledge"

by nofernandes (Beadle)
on Jul 15, 2003 at 19:06 UTC ( [id://274528]=note: print w/replies, xml ) Need Help??


in reply to Regex "(un)Knowledge"

Hmm i see.. but i cannot make this run!! Iīm a little bit of newbie in the Perl Language!!!!!

Can you explain me why does my code donīt work!??

$file="Finger.java"; open(F,"$file"); undef $/; my %hash; my $re= qr{ ( /\* .*? \*/) | ( \/\/[^\n]*) | " (?: [^"\\]* | \\. )* " | ' (?: [^'\\]* | \\. )* ' | . [^/"']* }xs; while( /$re/g ) { $hash{pos($_)}= $1; } my @nl; while( /\n/g ) { push @nl, pos($_); } my $ln= 1; while( /$re/g ) { $ln++ while $nl[$ln-1] < pos($_); $hash{$ln}= $1; } @keys=sort {$a<=>$b} (keys %hash); foreach $key (@keys) { $value=$hash{$key}; $hash_ordenada{$key}=$value; print "Line: $key\t$value\n"; }

Thank you very much!

nofernandes!

Replies are listed 'Best First'.
Re: Re: Regex "(un)Knowledge"
by bm (Hermit) on Jul 16, 2003 at 09:34 UTC
    Can you explain me why does my code donīt work!??

    You! will! get! much! better! explanations! if! you! tell! us! what! don't work!?? means!!!!!!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-23 20:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found