On Thu, 17 Oct 2002, Jeff 'japhy' Pinyan wrote: > On Oct 17, Mandar Rahurkar said: > > >> >> @new = grep { ! /^$no/ } @list; > >> >> @new = grep !/^\Q$no/, @list; > >> > > >> >thanks for your prompt reply...however this does not work.. > >> >program does not generate any output... > >> > >> What program? Please show us the code you're (now) using. > > > >$spkr=shift(@ARGV); > >@list = `ls`; > >@n_train_list = grep !{/^$spkr/}, @list; > >print @n_train_list; > > You're messing up your grep(). (And you don't have warnings on, or else > you'd be given some warnings that might help you figure things out.) > > grep() comes in two flavors: > > grep { CODE } LIST > > and > > grep EXPR, LIST > > The first form has no comma, the second does. Your code is the 2nd form, > and you're logically negating a hash reference. You want either > > grep { !/^$spkr/ } @list; > > or > > grep !/^$spkr/, @list; Thanks a lot Jeff ..it works.....however suppose i find spkr without special character. for eg not 145 so 147a will do but 147d will not. how can i introduce another negation ? I hope I have made myself understandable. Thanks a million.. -Mandar
> > -- > Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ > RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ > ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** > <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. > [ I'm looking for programming work. If you like my work, let me know. ] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]